Search Results UI: Presenting What the Engine Returns

Search Results UI: Presenting What the Engine Returns

Users never see the ranking function, only the page. Here is highlighting as the honesty mechanism, match-centered snippets, and the restorability test that settles pagination.

Users cannot see your ranking function, so they judge search largely by what the results page shows them — which means a well-ranked list presented badly reads as bad search. The engineering that matters here is match highlighting that explains why each result appeared, snippets windowed on the match rather than truncated from the top, and a pagination choice settled by which pattern you can actually restore when someone presses back.

Presentation shapes perceived relevance

Nobody who uses your search will ever see the scoring function. They see a page. The judgments they form about whether the search is any good are formed largely from cards, snippets, ordering, and how the page behaves when they interact with it. This is why a results page is not a rendering detail downstream of the interesting work — it is where all of the interesting work either becomes visible or fails to.

Match highlighting is the page's honesty mechanism, and its absence causes a specific failure. When a user searches one term and the page returns a result containing a different word, highlighting shows them the connection: the matched term, in context, in the snippet. Without it, the tolerant matches the pipeline makes — a typo correction, a synonym expansion, a stemmed form, a semantic neighbor — can arrive on the page looking like randomness. The better a retrieval pipeline gets at matching things the user did not literally type, the more it depends on highlighting to keep that from reading as noise.

The result-card contract differs per document type, and it is worth writing down rather than discovering through bug reports. A product card needs enough to make a click decision: image, name, price, availability. An article card needs a title and enough excerpt to judge relevance, plus a date where recency matters. A help-content card needs to look answerable — a title phrased as the problem, and a snippet showing the relevant passage. Each of those fields must exist in the index as a display field, which is a constraint on document design rather than something the page can conjure. Baymard Institute's e-commerce search research includes a report on the layout and design of search results, including search snippets (Baymard Institute, as of November 2026).

Snippets and highlighting mechanics

Snippet field selection is the first decision. The excerpt has to come from somewhere, and the obvious source is not always the right one: a short marketing description is clean but frequently contains none of the matched terms, while the full body contains the match but may be unformatted or wrapped in boilerplate. A fallback order handles this honestly — prefer the field where the match actually occurred if it is presentable, fall back to the description, fall back to a leading extract — with an explicit rule for what to do when the match is in a field unsuitable for display, such as an internal attribute or a tag list. Showing nothing is better than showing a fragment of machine-readable metadata.

Windowing is where snippets are won or lost. An excerpt truncated from the start of the field gives the user the first two lines of the document, which may have nothing to do with their query. An excerpt centered on the densest region of matches gives them the passage that caused this result to appear. That is the entire difference between a snippet that answers "why is this here" and one that wastes its two lines on a boilerplate opening sentence.

Highlighting tolerant matches raises a small question with a clear answer: highlight the form that actually matched, not the form the user typed. If they typed a misspelling and the corrected term matched, highlight the corrected term where it appears — the disclosure copy at the top of the page is what explains the substitution, and duplicating that explanation inside every snippet is noise. The same holds for stemmed forms and synonym expansions: the user sees the word in the document that caused the match, and the page explains the mechanism once.

One implementation detail carries security weight. Engine highlighting typically returns fragments with markup already inserted around the matched terms (Elasticsearch highlighting settings reference, as of November 2026). That markup arrives as a string containing tags, which means it cannot be injected into the page without sanitization — engine-returned content derives from indexed document content, and indexed document content is only as trustworthy as whatever wrote it. Treat highlight fragments as untrusted markup and sanitize to an allowlist of the specific tag you expect.

Sort, paginate, restore

Relevance is the default sort, and it usually goes unnamed in the control until the user chooses something else — at which point the choice must be explicit and visible. The alternatives are the ones the catalog supports meaningfully: price, recency, rating. Every one of them is a user choice that has to survive navigation, which means sort state lives in the URL under exactly the same contract the filter state does.

The pagination-versus-load-more argument is usually conducted as a matter of taste, and it has an engineering answer that settles it: whichever pattern your team can make fully restorable is the right one. The test is concrete. A user scrolls to the fortieth result, clicks it, looks at the page, decides it is wrong, and presses back. They should land on the same scroll position, with the same forty results present, without a refetch that reshuffles the list. Classic pagination passes this test cheaply — page number in the URL, which re-requests the same page, though its contents can shift if the index has been refreshed in between. Infinite scroll passes it reliably only with deliberate work: recording the loaded ranges and the scroll offset, restoring them on return. When the result click is a full browser-managed navigation and the page is eligible, the browser's back/forward cache can restore the whole page if the user goes back soon, but eligibility depends on how the page is built, and it does not work for soft navigations inside a single-page app (web.dev, as of November 2026). Infinite scroll that cannot restore is a worse choice than pagination that can, regardless of which one demos better.

PatternRestorable by defaultState to persistWhere it breaks
Numbered paginationYesPage number in URLDeep paging cost at high offsets
Load-more buttonNot reliablyLoaded count plus scroll offsetReturning user sees only the first page when the page is rebuilt rather than restored from the back/forward cache
Infinite scrollNot reliablyLoaded ranges plus scroll offsetBack navigation dumps the user at the top when the page is rebuilt rather than restored from the back/forward cache

Result-count honesty is a small thing that erodes trust quickly when it is wrong. Either show an exact count the user can rely on, or show an honest approximation and label it as approximate. What breaks trust is a precise-looking number that changes when the user advances a page — which can happen, because engines differ in how they count and some deliberately cap or estimate totals for performance reasons. Check the count semantics your engine actually provides against its current documentation, and present the number with the confidence those semantics support rather than the confidence a bare integer implies.

Loading behavior deserves one sentence: results should arrive without shifting the layout under a user who has already started reading, and the broader question of skeletons, spinners, and loading-performance budgets belongs to the performance literature rather than here.

Mixed result types

When one query spans products, articles, and help content, the architecture decision is where the ranking problem lives. Scoped tabs put it inside each scope: each tab ranks its own type, and the per-tab counts tell the user what is available elsewhere. A blended list puts it across types: one list, typed cards, one ordering. A primary scope with secondary strips splits the difference — one type owns the main list, the others appear as bounded sections.

Blending carries an honesty problem worth naming. Relevance scores from different document types are not naturally comparable. A help article's score and a product's score are produced against different fields, different lengths, and different term distributions, and treating them as one ordered scale is not a ranking — it is an accident with a plausible shape. Blended lists need deliberate slotting rules: how many of each type, in which regions of the list, under what conditions. Skipping that step is how support content buries the products a commercial site exists to sell, with a scoring function that looks principled the whole time.

Scope routing from query intent handles the clear cases well. Patterns that unambiguously belong to one type — an order reference, a part number, a support-shaped phrasing — can route confidently to the right scope. Keep that as a curated ruleset with an owner rather than an inferred classification: the rules are few, they are readable, and when one misfires you can see exactly which one did.

Three boundaries close this out. The suggest dropdown above the search box is its own subsystem with its own latency budget. The filter rail beside the list — its semantics, counts, and URL encoding — is the faceted-navigation surface, and this page shares that state contract rather than restating it. And why results are ordered the way they are belongs to relevance work; this page owns only how that order is shown.

Project Inquiry