
Faceted Navigation: Engineering the Filter Surface
The filter rail is only as good as the fields behind it. Here are the OR-within, AND-across selection semantics, counts that stay honest, and URL state that survives the back button.
TL;DR: Facets are the queryable shape of your catalog, which means the filter rail can only ever be as good as the structured fields behind it — UI work can paper over three spellings of the same brand but does not repair them. The engineering decisions that matter are selection semantics that follow the OR-within, AND-across convention, counts that stay honest as selections change, filter state that lives in the URL, and a counting strategy that survives high cardinality.
Facet quality is decided upstream
The dependency is worth stating before anything else, because it determines how much of the work in front of you is actually filter-rail work. Facets render whatever the filter fields contain. If the catalog stores a brand name three different ways, the rail shows three checkboxes for one brand and splits the counts between them. If a product's material is described in a prose paragraph rather than captured in a field, no facet for material can exist at all. Both failures look like filter bugs to a user and to a product manager, and neither is repaired in the component that draws the rail. The normalization and extraction work belongs to the index's document design, and consuming clean fields is the most useful thing a filter surface can do with them.
Given clean fields, the next decision is which attributes earn a facet. Three properties matter together. Coverage: an attribute present on a fifth of the result set produces a facet that strands users who select it, because selecting it discards everything that simply lacks the data rather than everything that fails the criterion. Cardinality: as a rough illustration rather than a measured threshold, three options is a toggle, thirty is a scrollable list, three thousand is a search box inside the facet, and pretending the third case is the first produces a rail nobody can use. Alignment with how people actually narrow: the attributes users think in are not always the attributes the catalog was modeled around. Baymard Institute's product-list and filtering research is the attributed anchor worth reading on which filter types users need to narrow a product list and how filters are laid out and made discoverable (Baymard Institute, product-list research, as of November 2026).
Facet order is configuration someone owns, not an alphabetical accident. The attributes that carry the most decision weight for the catalog belong at the top of the rail, and that ordering is a maintained choice that changes as the catalog changes — not a property of how the fields happen to sort.
One scope note, because it saves duplicated work: facets serve query results and category browsing identically. A user filtering a search result set and a user filtering a category page are exercising the same mechanism against the same fields, and building two separate filter implementations for them duplicates work that one shared mechanism already covers. The mechanics below apply once, to both.
Selection semantics to get right
There is a convention specific enough to state as a rule: OR within a facet, AND across facets. Selecting red and blue in a color facet means red or blue. Selecting red in color and under-fifty in price means red and under fifty. Deviating from it is not a design choice you get to make quietly — if a facet uses AND within itself because the domain genuinely requires it, the rail has to signal that, or the results will read as broken.
The behavior that follows from the OR rule is easy to get wrong. After a user selects red, the other color options must remain visible and selectable, with their counts recomputed as if only the other facets were applied. This is standard disjunctive faceting: each facet's counts are computed against the result set filtered by every facet except itself. It is what makes "actually, show me blue too" a single click instead of a reset-and-start-over.
Skip that rule and you get the disappearing-option problem. Compute every facet's counts against the fully filtered set — including its own selection — and every unselected color drops to zero — or, where products can carry several colors, to the products tagged with both colors — because the current result set contains only red products. The naive implementation then hides or disables the zero-count ones, and the user is stranded inside their own first click with no path sideways. The fix is not in the presentation layer; it is in which filter set each facet's count aggregation runs against.
| Facet type | Within-facet selection | Counts computed against | Failure mode |
|---|---|---|---|
| Multi-select attribute (color, brand) | OR | All other facets, excluding itself | Disappearing options when self-filtered |
| Single-select attribute (sort-like, mutually exclusive) | Replace | All other facets | Rendered as checkboxes, implying OR |
| Boolean flag (in stock, on sale) | AND with the rest | All other facets | Left on by default without disclosure |
| Range (price, size) | Single range, OR across buckets | All other facets | Empty buckets shown as selectable |
| High-cardinality attribute (thousands of values) | OR, with in-facet search | All other facets, top-N returned by default | Missing or approximate counts shown as exact |
Range facets carry their own edges. Bucket boundaries are a product decision that leaks into engineering: buckets chosen for a catalog's old price distribution strand users when the distribution shifts. Empty buckets should not be offered as selectable options. User-entered ranges need to be reconciled with the bucketed presentation rather than existing as a parallel mechanism, and the engine's support for range aggregation shapes how cheaply this can be done — a capability worth verifying against your engine's current documentation rather than assumed from a previous project.
Filter state lives in the URL
The contract is short and it has three tests. Every filter combination is a URL. The back button restores the previous combination. A reload preserves the current one. A pasted link reproduces it for someone else. Filter state held only in component memory fails all three, and it fails them in the exact moment that matters most — the user clicks a result, decides it is wrong, and presses back to find their carefully narrowed set replaced by an unfiltered list.
The encoding decisions are small but they compound. Parameter names should be readable enough that a support engineer can diagnose a reported URL by eye. Multi-value encoding needs one convention applied consistently rather than one per facet. Ordering has to be stable, so that two equivalent selections produce byte-identical URLs — otherwise caching, analytics grouping, and any equality check on filter state all quietly misbehave. And the reset affordance should clear to the canonical unfiltered URL rather than to a URL carrying empty parameters, which is the same page with a different address.
History mechanics deserve a deliberate decision rather than a default. Pushing a history entry for every checkbox toggle turns the back button into an undo stack for individual clicks, which is not what users mean when they press it. Replacing the entry keeps the URL current without flooding history, at the cost of losing intermediate states. One workable split is replacing for rapid within-facet toggles and pushing for changes that meaningfully redefine the result set, which is a judgment call the rail's owner should make explicitly.
One external boundary belongs here in a single sentence: which faceted URLs search engines are permitted to crawl and index is a crawl-budget and canonical-URL question that belongs to external-discovery work, and this surface owns only the user-facing state contract.
Counting cost and honest edges
Facet counts are aggregations over the entire matching result set — for each facet, the set filtered by every other facet — not over the page of results being displayed. This is the sentence that explains why facet counting is the expensive part of a filtered query rather than an incidental extra. A result set of forty thousand documents produces a page of twenty and a set of counts derived from all forty thousand, and every facet on the rail adds another aggregation to compute. High-cardinality facets are the costly ones: counting across thousands of distinct brand values is structurally more work than counting across five sizes, and engines return only the top values by default — ten in Elasticsearch's terms aggregation and in Typesense's max_facet_values, both configurable, Elasticsearch's up to its search.max_buckets limit (as of November 2026) — which means the count you display for a long-tail option may be missing or approximate in ways worth understanding before presenting it as exact. The aggregation model underneath this is documented directly for the dedicated-engine class (Elasticsearch aggregations reference, as of November 2026), and built-in faceting is available in the lighter-weight engine class as well (Typesense 30.2 search API documentation, as of November 2026) — capabilities in this area move, so verify against current documentation rather than a remembered version. Caching keyed by the exact filter state is one way to bound the cost, which is another reason stable URL encoding earns its keep: the cache key and the URL can be the same normalized thing.
The empty intersection is the edge where honest counts pay off. A user selects a combination that yields nothing. If counts are honest, this is largely preventable: zero-count options are disabled or hidden by policy before they can be clicked. Where it is reached anyway — filters applied in an order the count refresh could not anticipate, or a catalog that changed between requests — the recovery is specific: offer to clear the most recent filter, the one that took the count to zero, rather than offering a bare restart. The full treatment of what a zero-result page owes the user is the recovery surface's territory; what belongs here is preventing the empty intersection where counts can and giving a one-click way back out where they could not.
Mobile presentation is worth naming at concept level without borrowing the design literature's job: the rail can become a sheet, applied filters can become dismissible chips, and applying can happen in a batch rather than per-click. Each of those shifts the count-refresh timing, which is the engineering consequence; the interaction and visual language around it belongs to design.
Three boundaries close this out. What appears in the result list as filters change — cards, snippets, sorting, pagination — is the results-page surface. The attributes themselves, their normalization and their binding to analyzers, are the index's document design. And announcing changed result counts to screen-reader users can fall under WCAG 2.2 Success Criterion 4.1.3 Status Messages (Level AA): its Understanding document treats brief text messages displayed about the completion or status of a search, such as "Searching...", "18 results returned" or "No results returned", as status updates if they do not take focus or cause a page refresh, while the list of results itself is not a status update. The announcement patterns themselves are covered properly by the accessibility literature rather than approximated here.