Search that doesn't feel broken: designing the UX before the engine
When a client says "the search is broken," the cause is rarely the search engine. The engine usually returns plausible results. The problem is the ten decisions around it: what a result row shows, what happens with zero results, whether filters combine sensibly. Search is one of the few features where users consciously notice quality, and a bad experience there colors how they judge the whole product.
A result row that answers before the click
A user scans results and decides which to open without opening any. That means each result must carry enough on its own: in an inbox, who sent it and when; in a shop, price and availability; in a help center, which section of the docs. Two details earn their keep constantly:
- The matched text, with the query highlighted. A snippet showing where the term appears tells users whether this document actually discusses their query or merely includes the word. PostgreSQL full-text search produces this with
ts_headline, and a highlighting config takes minutes. - Honest sorting. Relevance-sorted results are right for broad queries; recency wins in inboxes and logs; for structured data, users often want a table they can sort themselves. Choose a default that matches the data, then expose the control. And when someone filters by a date range, silently switching to relevance order reads as broken — sort by the filter's dimension.
Zero results is a design problem
The empty state gets skipped in development because a real query always matches. The first time an actual user mistypes a product name, they get a blank page and read it as "you don't sell this." What a zero-result page should do:
- Say plainly that nothing matched, including the query the user typed.
- Suggest relaxed alternatives: fewer words, matched-against-everything else. The "did you mean" prompt (or simply running the corrected query automatically) recovers a large share of abandoned searches.
- Offer the escape hatches: browse the category tree, contact support for products behind a login.
Implementing suggestions can be as simple as a trigram similarity lookup for near-terms or a prefix search for autocompletion, so it doesn't require a separate suggestion service.
Filters: how they combine, and what users can see
Faceted search fails in predictable ways. Filters that are silently AND-ed when users expect OR (or vice versa) make results seem to vanish. Ranges with no visual feedback make people guess. The fixes are routine:
- Show the active filters as tokens at the top of the results, each removable with one click. Every filter state must be reversible by looking at the screen, not by remembering what you clicked.
- Show result counts on filter options where you can compute them cheaply, so users can see whether adding a filter empties the list before applying it.
- For small catalogs, a filter sidebar is often a waste — a well-sorted flat list answers questions faster than refining.
- Every state should produce a URL that reproduces and can be shared. It's the cheapest feature in the list and the one support will use most.
Testing search like a user, not like a developer
Developers test with terms they know exist, which is exactly what users don't do. Before launch, gather queries from somewhere real — the words users type is a good start — and check a fixed set against the index:
- Singular vs. plural forms, and natural-word singulars against plural data.
- Words without diacritics or accents (a French name typed without its accent should still match).
- Typos to a reasonable tolerance; fuzzy or trigram-based matching covers most of them.
- Multi-word queries where word order matters and where it should not.
- Empty results: confirm the design, not a blank page, answers.
Search quality is a product property as much as an engine property. An index fed by real user queries, a results page that shows its reasoning, and tested query sets cover most of what users actually experience. That, plus the engine decisions in our full-text search article, is what "search works" means in practice.