Try our conversational search powered by Generative AI!

filter like string

Vote:
 

I have a string array("Sweden","India","Australia"). I want to dispaly those page whose have the follwing anyone country in their tage page.In each page tag data present with coma seprated.

Page1(Hashtag:India,Pakistan,Srilanka)

Page2(Hashtag:Australia,Iran,Nepal)

Page3(Hashtag:Pakistan,Sweden)

Page4(Hashtag:Pakistan,nepal,Srilanka)

Output:

Page,Page2,Page3

Code:

.Instance.Search()

.For(query)

.Filter(x=> x.Hashtag.In(new Lst{"Sweden","India","Australia"}))

using IN i can not find data from coma separtaed tag. Is there any like searh for it like '%India%' ?

#162785
Oct 15, 2016 5:18
Vote:
 

I would add a separate field to page type that is a string array and index that one using convention. Then you can use

var searchQuery = client.Search<BlogPost>()
    .Filter(x => x.Tags.Match("Find"));
#162788
Oct 15, 2016 8:34
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.