Facet counts are incorrect

Created on 15 April 2025, about 2 months ago

Problem/Motivation

When adding a "OR" type facet to an Opensearch view, the facet counts, and available facets when supplying a search query, make no sense, and can produce empty result sets when using multiple filters.

Steps to reproduce

Create a view, add a Fulltext search filter, as well as two other facets driven filters, such as Content type and Recipe category (Umami).

Search for the word "the", and select "Snacks" as a Recipe Category. See attached image for a view of the result. The facet numbers do not change, and the results do not match the number of results displayed by the facets.

Proposed resolution

Opensearch's recommendation is:

Take care: as soon as you work with multiple facets (that is, apply filters to several fields) you will need further queries to compute the hypothetical facets. This is because a single query without any filter will not provide the expected results. One query per field will be needed, using the active filters for the other fields but no filter for the current field.

Depending on the wanted boolean behaviour (OR or AND) between the different facets this could get quite involved ;)

πŸ› Bug report
Status

Active

Version

2.4

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States crashtest_ Richland, WA

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024