#community-help

Clarification on Configurable Filters in typesense v.0.22

TLDR gab asked for document clarification of auto-apply filters feature in typesense v0.22. Kishore Nallan provided a link and Jason confirmed gab's understanding ensuring proper syntax.

Powered by Struct AI
5
21mo
Solved
Join the chat
Dec 21, 2021 (21 months ago)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:22 PM
Hi,
Could you please tell me more or give me the relevant document part about this new feature of v.0.22 "Configurable rules to auto-apply filters. Eg: "Best-rated restaurants" can automatically trigger the filter "rating > 4.5""
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:25 PM
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
04:43 PM
Ah thank you!
Could you please confirm I well understood the parallel?
lets say I have configured this rule
override = {
  "rule": {
    "query": "Best-rated restaurants",
    "match": "exact"
  },
  "filter_by": "rating > 4.5",
}

And I make this query
let searchParameters = {
  'q': 'Best-rated restaurants',
}
client.collections('restaurants').documents().search(searchParameters)

It will apply the filer "rating > 4.5"
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
05:06 PM
gab That's correct, except for the filter_by syntax. It should be "filter_by": "rating:>4.5" (colon after rating)
gab
Photo of md5-8be2a24edf7a95c9c74abce4b1130c3e
gab
05:06 PM
Ok great, thanks for clarification !