c# - How to perform word search using LINQ? -


i have list contains name of suppliers. say

suppid   supplier name ---------------------------------- 1        aardema & whitelaw 2        aafedt forde gray 3        whitelaw & sears-ewald 

using following linq query

supplierlistquery = supplierlistquery.where(x => x.suppliername.contains(searchkey)); 

i can return records correctly in following conditions,

1) if using search string "whitelaw & sears-ewald" return 3rd record.

2) if using "whitelaw" or "sears-ewald" return 3rd record.

but how can return 3rd record if giving search string "whitelaw sears-ewald". returns 0 records.

can use result, dont know how use particular need.

what in situation split words collection, perform following:

var searchopts = searchkey.split(' ').tolist(); supplierlistquery = supplierlistquery     .where(x => searchopts.any(y=> x.suppliername.contains(y))); 

Comments

Popular posts from this blog

searchKeyword not working in AngularJS filter -

sequelize.js - Sequelize: sort by enum cases -

user interface - how to replace an ongoing process of image capture from another process call over the same ImageLabel in python's GUI TKinter -