I am trying to build a search that accepts multiple keywords (space delimited or comma, that is not the issue). I currently have this
public IQueryable<Post> Search(string criteria, int x)
{
return
(_db.Posts.Where(p => p.IsActive &&
(p.PostText.Contains(criteria) || p.Weather.Contains(criteria) || p.Location.Contains(criteria))
).OrderByDescending(p => p.PostDate)).Take(x);
}
but that would return only exact matches. How would I search for each keyword and return x results? It's supposed to be an OR by the way.
Thanks