#community-help

Query Logic in 'q' Parameter

TLDR A had a question about using AND and OR in the 'q' parameters. Jason clarified that 'filter_by' should be used for structured search instead.

Powered by Struct AI
+11
7
20mo
Solved
Join the chat
Jan 09, 2022 (20 months ago)
A
Photo of md5-fe034fbff44e9cae037b7bb23a5080c4
A
05:26 PM
Hi there, is there some way to use AND and OR as part of query in q parameter? Search for item1 AND item2 or item1 or item2 ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:34 PM
A We don’t support that in the q parameter since it’s meant for free text. If you need more structured search you want to use filter_by which supports or & and
A
Photo of md5-fe034fbff44e9cae037b7bb23a5080c4
A
05:35 PM
so what is the logic behavior when enter more than one term in q ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:37 PM
It first tries to look for documents that contain all keywords, then if drop_tokens_threshold number of documents are not found, it starts dropping terms right to left and repeats the search until that threshold is met
A
Photo of md5-fe034fbff44e9cae037b7bb23a5080c4
A
05:38 PM
alright, tnx for now 🙂
+11
05:38
A
05:38 PM
will report back when my integration with Plone 6 is more mature^^
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:40 PM
TIL about Plone CMS :-)