how to set a query for like query in azure search

2019-07-28 03:13发布

问题:

I am trying azure search from my project and i am trying the following

 indexClient.Documents.Search<AuctionResult>("john", new SearchParameters { IncludeTotalResultCount = true, Filter = "SoldDate ge 2017-04-06 and SoldDate le 2017-04-06 and substringof(Title, '2007')" });

what i need is i need to filter the result based on the field Title, if Title contains the text '2007', it should be included.

what went wrong for me, what change should i make?

回答1:

at last i found the solution

so we should use the following in the query

search.ismatch('searchQuery',Search_feild)"

so

"SoldDate ge 2017-04-06 and SoldDate le 2017-04-06 and search.ismatch('2007','Title')"


回答2:

You can use a regex query to search within words. See the answer to this question for details.