How can I make a GraphQL search by using fulltext OR tags?

I want to search not only by fields, but also by tags. The problem is that when I use (fulltext:"search", tags:["search"]) it search for posts that have both a "search" keyword and a "search" tag. In other words, I want to make a logic OR, not a logic AND. Thanks

2 Likes

Hi @sjrmiranda, unfortunately it isn't possible to do an OR query like this for fulltext and tags. The only workaround I can think of would be to run two separate queries and combine the results.

2 Likes

Thank you for you answer. The solution I found was simply creating a custom tag field(just a normal text field) and when I do the fulltext search it will work.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

This is being tracked as an open feature request.

If you have another use-case for this feature, you can 'Flag' this topic to reopen. Please use the :heart: button to show your support for the feature and check out our Feature Request Guidelines.

Is this feature available now in the latest version? We wanna do fulltext search for 2 fields with OR operation.

Hi @aniruddha.shevle ,

This isn't something that is available, and it's not likely that we will implement this in the near future.

Thanks.

@Phil : Can we do a search by multiple tags with OR operation?

No, unfortunately that's not possible either.

Hey @Phil @Levi @Pau , how about filtering with [any(document.tags, ["tag-1", "tag-2", "tag-3"])], the result will be the documents having either tag-1 OR tag-2 OR tag-3 tags right? This will work as the OR operator correct? any will behave like OR operator right?

@Phil @Levi @Pau : Can you please acknowledge this?

@aniruddha.shevle Yes, the any filter works as an OR operator for tags. This will work if you are looking for an OR operator only for tags.

The original question of this thread was asking about an OR operation for tags and fulltext search. This is still not possible even with the any filter.

I hope this clarifies things for you. Let us know if you have any further questions.

1 Like

Yes, correct. Thanks.