说我有3个客户姓名:LINQ的 - 通过StartsWith订单则包含
Microsoft
Another customer also called Microsoft
A third customer called Microsoft
现在,如果我查询的客户是这样的...
var q = (from cust in db.Cust
where cust.Name.Contains("Microsoft")
orderby cust.Name ascending
select cust)
...我得到这个顺序:
A third customer called Microsoft
Another customer also called Microsoft
Microsoft
我想要的是基于它以“Microsoft”开头的事实得到Microsoft第一。
变迁包含对StartsWith当然给我留下了个结果,而不是3
难道这在单个查询做到吗?
我不这么认为,你几乎需要使用全文查询加权。 – Sam
@Sam - 我放弃了全文搜索。在搜索中使用空格时,它让我头疼。 – Malako