Dynamic Order By Entity Framework
I have the following query:
I was asked to make it so that searchText can have multiple searches, IE:
If I type in "Hello World", I should have the results ordered so that anything that starts with "Hello" or "World" appears first. But this needs to be dynamic in length.
So the search text "Hello World Bob" would check for three items.
In addition, I need to support partial matches. So "Hel Wor Bo" would at minimum return the same results as "Hello World Bob".
How would I go about doing this? If I didn't need to worry about partial matches, I could just do
But I need to support partial queries.
I was asked to make it so that searchText can have multiple searches, IE:
If I type in "Hello World", I should have the results ordered so that anything that starts with "Hello" or "World" appears first. But this needs to be dynamic in length.
So the search text "Hello World Bob" would check for three items.
In addition, I need to support partial matches. So "Hel Wor Bo" would at minimum return the same results as "Hello World Bob".
How would I go about doing this? If I didn't need to worry about partial matches, I could just do
p => searchText.Contains(p.Name).But I need to support partial queries.
