I can use linq to sql to match a part of a string with
From C In DB.City Where C.Name.Contains(Query)
What i need to do for it to match only beginning of words? (Behave like full text index)
I can use linq to sql to match a part of a string with
From C In DB.City Where C.Name.Contains(Query)
What i need to do for it to match only beginning of words? (Behave like full text index)
You can check if the first word starts with the query by using StartsWith
instead of Contains
:
C.Name.StartsWith(Query)
This only checks the first word, not all words in the string.
You can't do a full text search directly using LINQ. What you can do instead is create a stored procedure to do the full text search and call that using LINQ.
Related question:
See also: