Counts per filter can be stored pre-computed, using the same inverted index structure the search uses.
Keyword -> (num_docs, doc1,doc3,doc4,…)
So you can quite quickly look up the number of matches.
Keyword -> (num_docs, doc1,doc3,doc4,…)
So you can quite quickly look up the number of matches.
With faceted search you usually need to do things like "the user searched for 'x' and filtered for 'price less than $Y', now show counts for each of the different categories" - where pre-calculated counts won't help you.
Search indexes still help here, because they are really good at fast set intersections - so you take the set of document IDs matching your filters so far, then intersect them against the set of IDs that are listed for each of those categories and count the size of that intersection.