TLDRgab inquired about dynamic faceting with custom filters. Jason explained that this would involve a computed field, which is currently not supported.
gab
Tue, 21 Dec 2021 17:56:57 UTC
Hi,
Is there any means to do what I would call naively "dynamic/on the fly faceting". I'm not sure how to explains what I want to do but lets try.
I would like to have copples of custom filter rules where the boolean result of those rules would be a facet. Then to be able to retrieve like with facets, what is the count for "true"/"false". But it seems for this I need to have a facet field in my model definition.
What could be another way than to add/update the facet based on the result of this custom filter rule on each document?
Ex. I have a facet field called `count_sellable_products` that is a number
Now I would like to add some custom filter rules like:
```{
ruleId: 'seller',
query: 'count_sellable_products: > 0'
}
{
ruleId: 'super_seller',
query: 'count_sellable_products: > 100'
}```
What I would like is to be able to retrieve the count for each "filter".
```facet_by=[seller,super_seller]```
Jason
Tue, 21 Dec 2021 19:23:31 UTC
gab What you're referring to would be a computed field ()... We don't have support for it at the moment.
So you would have to pre-compute the field when indexing the document and then facet by that field
gab
Wed, 22 Dec 2021 15:54:10 UTC
I see, thanks
Typesense
Indexed 3051 threads
Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI
gab
Tue, 21 Dec 2021 17:56:57 UTCHi, Is there any means to do what I would call naively "dynamic/on the fly faceting". I'm not sure how to explains what I want to do but lets try. I would like to have copples of custom filter rules where the boolean result of those rules would be a facet. Then to be able to retrieve like with facets, what is the count for "true"/"false". But it seems for this I need to have a facet field in my model definition. What could be another way than to add/update the facet based on the result of this custom filter rule on each document? Ex. I have a facet field called `count_sellable_products` that is a number Now I would like to add some custom filter rules like: ```{ ruleId: 'seller', query: 'count_sellable_products: > 0' } { ruleId: 'super_seller', query: 'count_sellable_products: > 100' }``` What I would like is to be able to retrieve the count for each "filter". ```facet_by=[seller,super_seller]```