Max Priazhevskii
05/21/2025, 2:24 AMbestseller.{store}
fields (one per region). We want a single override that promotes or demotes bestsellers for certain searches/filters, picking the right bestseller.{store}
field based on the visitor’s store, which we can pass within the search query somewhere. Kinda like dynamic filtering, but for sorting.
What’s the best approach? And would it make sense to add this as a TS overrides feature?Kishore Nallan
05/21/2025, 3:50 AMsort_by
clause -- have you tried using that along with override tags? https://typesense.org/docs/28.0/api/curation.html#add-tags-to-rulesMax Priazhevskii
05/21/2025, 4:01 AMKishore Nallan
05/21/2025, 4:02 AMMax Priazhevskii
05/21/2025, 4:15 AM"rule": {
"filter_by": "category:=`wine` && store:={store}",
"tags": ["bestsellers"]
},
"sort_by": "bestseller.{store}, newest.{store}",
^ so to apply this override dynamically to all stores when a search query contains a tag and a store “var” in the filterKishore Nallan
05/21/2025, 4:17 AMKishore Nallan
05/21/2025, 4:18 AMKishore Nallan
05/21/2025, 4:18 AMMax Priazhevskii
05/21/2025, 4:19 AMAlain Russell
05/21/2025, 4:28 AMAlain Russell
05/21/2025, 5:01 AMMax Priazhevskii
05/21/2025, 9:50 AMKishore Nallan
06/13/2025, 5:17 AMCould not find a field named...
There are a number of things wrong with the setup:
1. The collection schema should have "enable_nested_fields": true,
otherwise the children of the object fields won't be discovered and added to the schema.
2. There is an override rule created by targeting "query": "{region}"
but the query is q=*
-- it won't match the ruleMax Priazhevskii
06/13/2025, 5:22 AMKishore Nallan
06/13/2025, 5:37 AMMax Priazhevskii
06/13/2025, 5:41 AM"enable_nested_fields": true,
and there is still an error for any search from *
to product NSW
. The search only works with enable_overrides:false
.Kishore Nallan
06/13/2025, 5:57 AMAlain Russell
06/16/2025, 9:34 PMKishore Nallan
06/17/2025, 4:07 AMKishore Nallan
06/17/2025, 5:46 AM29.0.rc30
Alain Russell
06/17/2025, 6:56 AMMax Priazhevskii
06/17/2025, 11:19 AMbestseller:region.qld
but not for bestseller:region.QLD
(see attached).Kishore Nallan
06/17/2025, 1:14 PMKishore Nallan
06/18/2025, 4:38 PMq=NSW
will be tokenized to a lowercase form, so it becomes nsw
. Now, when we try to look for a field called bestseller:region.nsw
that does not exist in the schema. So you have to use lower case field names if you want the override rule to be triggered. Likewise, in filter_by
use the lowercase form as well: filter_by=region:=qld
2. You have defined {"name": ".*", "type": "auto" }
-- this may not set sort: true
so better to set an explicit schema like this: {"name": "bestseller:region.*", "type": "string", "sort":true }
-- in general always prefer an explicit schema.
With these two fixes, it will work.Max Priazhevskii
06/18/2025, 11:43 PM"filter_by": "region:={region}"
override works for lowercase field names but not uppercase ones. I’ve attached an example with an explicit schema.
We can work around the casing issue on our end, just want to confirm this is expected for the filter_by overrides too.Kishore Nallan
06/19/2025, 4:54 AMMax Priazhevskii
06/19/2025, 5:44 AM