This question is locked. New answers and comments are not allowed.
I have a textbox that takes free text as input for a search and I have a LINQ
query that I want to extend with this type of search.
The input could be something like "big blue car"
and that should result in a query that searches for titles that contain all these words.
There is also an option to switch to "any word" instead of "all words".
What is the best/easiest way to add this to my LINQ
query?
The query now looks like
from b in books
where b.InStore == true && b.Price > 10 && title.Contains()...at this point i want to add the text search.
select b
And i think i have to do something like this:
var searchTerms = input.Split(' ');
from b in books
where b.InStore == true && b.Price > 10
&& (searchTerms.All(x => b.Title.Contains(x)))
select b
But i keep getting this error : Must specify parameter on right side of operation.