I am having a Field say Company name and the want to partially search for the data entered by user that might be space separated. Say the user enters 'ABC India PVT Ltd' the query must search for all the records that contain any one or more of the entered words. like in sql it would be
Select *
from Company
where CompanyName like '%ABC%' or
CompanyName like '%India%' or
CompanyName like '%PVT%' or
CompanyName like '%Ltd%'
I am trying some to do something like this
string search = "ABC India PVT Ltd"
String[] searchArray = search.Split(' ');
IEnumerable<Account> accountInfo = acctInfo.Get(Filter: a
=>searchArray.AsQueryable().Contains(a.CompanyName));
but this gives me exactly opposite of what i am trying to achieve. Is there a way i can achieve this.
The basic idea is to wildcard search, companyname field for any of the searchArray values.
a.CompanyName.Contains('Any value from searchArray')