Range facet values not returned when filtering
WimVergouwe opened this issue · comments
Description
As requested: copied from slack channel
Seeing a weird issue with faceting: if I use a range facet combined with a filter_by, the facet values are not returned for the ranges:
collection creation:
{
"name": "simplefaceting_default_products",
"fields": [
{
"name": "name",
"type": "string",
"facet": false,
"sort": true
},
{
"name": "brand",
"type": "string",
"facet": true,
"sort": false
},
{
"name": "price",
"type": "float",
"facet": true,
"sort": false
}
]
}
importing some docs:
{"id":"pd-1","name":"Keyboard","brand":"Logitech","price":49.99}
{"id":"pd-2","name":"Mouse","brand":"Logitech","price":29.99}
searching:
{
"searches": [
{
"collection": "simplefaceting_default_products",
"q": "*",
"filter_by": "brand:=Logitech",
"sort_by": "name:asc",
"facet_by": "brand,price(Low:[0, 30], Medium:[30, 75], High:[75, ])",
"max_facet_values": 100
}
]
}
results - facet values for price are not returned:
{
"results": [
{
"facet_counts": [
{
"counts": [
{
"count": 2,
"highlighted": "Logitech",
"value": "Logitech"
}
],
"field_name": "brand",
"sampled": false,
"stats": {
"total_values": 1
}
},
{
"counts": [],
"field_name": "price",
"sampled": false,
"stats": {
"avg": 39.99000072479248,
"max": 49.9900016784668,
"min": 29.989999771118164,
"sum": 79.980001449584961,
"total_values": 0
}
}
],
"found": 2,
"hits": [
{
"document": {
"brand": "Logitech",
"id": "pd-1",
"name": "Keyboard",
"price": 49.99
},
"highlight": {},
"highlights": []
},
{
"document": {
"brand": "Logitech",
"id": "pd-2",
"name": "Mouse",
"price": 29.99
},
"highlight": {},
"highlights": []
}
],
"out_of": 2,
"page": 1,
"request_params": {
"collection_name": "simplefaceting_default_products",
"first_q": "*",
"per_page": 10,
"q": "*"
},
"search_cutoff": false,
"search_time_ms": 7
}
]
}
searching without the filter:
{
"searches": [
{
"collection": "simplefaceting_default_products",
"q": "*",
"sort_by": "name:asc",
"facet_by": "brand,price(Low:[0, 30], Medium:[30, 75], High:[75, ])",
"max_facet_values": 100
}
]
}
results - facet values for price are returned:
{
"results": [
{
"facet_counts": [
{
"counts": [
{
"count": 2,
"highlighted": "Logitech",
"value": "Logitech"
}
],
"field_name": "brand",
"sampled": false,
"stats": {
"total_values": 1
}
},
{
"counts": [
{
"count": 1,
"highlighted": "",
"value": "Low"
},
{
"count": 1,
"highlighted": "",
"value": "Medium"
}
],
"field_name": "price",
"sampled": false,
"stats": {
"avg": 39.99000072479248,
"max": 49.9900016784668,
"min": 29.989999771118164,
"sum": 79.980001449584961,
"total_values": 2
}
}
],
"found": 2,
"hits": [
{
"document": {
"brand": "Logitech",
"id": "pd-1",
"name": "Keyboard",
"price": 49.99
},
"highlight": {},
"highlights": []
},
{
"document": {
"brand": "Logitech",
"id": "pd-2",
"name": "Mouse",
"price": 29.99
},
"highlight": {},
"highlights": []
}
],
"out_of": 2,
"page": 1,
"request_params": {
"collection_name": "simplefaceting_default_products",
"first_q": "*",
"per_page": 10,
"q": "*"
},
"search_cutoff": false,
"search_time_ms": 5
}
]
}
Metadata
Typesense Version: 26.0
OS: testcontainers
I have tested following http script on 27.0.rc8, but it doesn't seem to work.
Have you got any workaround for the time being? facing same issue