I am trying to filter entities based on a list of search values within specific fields on the entity.
For example:
var searchValues = new List<string> { "abc", "xyz" };
var posts = Context.Posts
.Where(p => searchValues.Any(v => p.Title.Contains(v)))
.ToList();
This generates an exception "The LINQ expression could not be translated. Either rewrite the query in a form that can be translated, or switch to client evaluation explicitly by inserting a call to 'AsEnumerable', 'AsAsyncEnumerable', 'ToList', or 'ToListAsync'.
What is the correct way to apply contains filters with multiple search values?