Invalid facet counts returned when adding a filter
Author: KerollmopsCreated May 14, 2024Updated Sep 11, 2026
Labelsbug
Meilisearch returns invalid facet counts in the facet distribution. When a filter is added to a query some of the facet counts increase. This issue is directly related to this Cloud issue (internal link) and you can find the datasets and settings there.
To Reproduce
- Send a simple query:
{"q":"glam","filter":[],"facets":["tags"],"page":0} - Look at the facet counts:
{"backpack": 9, "bag": 15} - Send the same query with a filter:
{"q":"glam","filter":[["tags = \"backpack\""]],"facets":["tags"],"page":0} - Look at the facet counts increase:
{"backpack": 43, "backpacking": 1, "bag": 43} - Send the another query with another filter:
{"q":"glam","filter":[["tags = \"backpack\"", "tags = \"bag\""]],"facets":["tags"],"page":0} - Look at the facet counts increase again:
{"backpack": 43, "backpacking": 1, "bag": 67}
Expected behavior
The facet count must be more precise/stable and must even decrease if you constrain the query more with filters. By using page: 0 or a very high limit, the engine must be exhaustive on the facet counts.
Meilisearch version: v1.8.0
Additional context On the Cloud, but probably not related.
Source: meilisearch/meilisearch