The same kind of filter engine a Magento/Adobe Commerce category page uses: check MULTIPLE categories, colors, sizes or brands at once - the server computes each facet value's count against every OTHER active filter, but ignoring the facet's own filter. That's why an already-selected value doesn't drop the rest of its facet to zero - the classic, often-broken trap of layered navigation.
A naive approach would apply every active filter to every facet count too - the moment you pick a color, the counts for the other colors would immediately drop to zero (since a product rarely comes in more than one color), falsely implying those other colors don't exist at all.
The correct approach computes each facet separately: the count for every value in a given facet has to be calculated against every OTHER active filter, while ignoring that facet's own filter.
This technique is known as "facet aggregation" in real search engines (Elasticsearch, Solr, Algolia), and every major e-commerce platform, Magento/Adobe Commerce included, uses this same principle for category page filters.
Performance-wise, this means a single query isn't enough for N facets - at least one separate aggregation has to run per facet, which becomes a serious optimization challenge at scale, typically solved with precomputed indexes, just as real search engines do.
This site uses Google Analytics to measure visits. This requires your consent - see the privacy policy for details. Privacy Policy