How does website search work?

Website search works in five stages: the site's content is indexed into a fast lookup structure; a typed query is corrected, expanded and classified; matching records are retrieved by keyword, meaning or both; results are ranked by relevance plus business signals; and the top results are presented with suggestions and filters.

Stage 1 — Indexing

Content is collected by crawling pages or syncing structured records, then normalised and stored in an index — an inverted index for keyword matching, a vector index for semantic matching, usually both. Everything downstream is limited by what got indexed and how fresh it is.

Stage 2 — Query understanding

The raw string is tokenised, spell-corrected, stemmed, expanded with synonyms, and mined for attributes and intent. "blak dress undr 3000" should become a corrected phrase, a category and a price ceiling. Most perceived relevance failures actually happen here.

Stage 3 — Retrieval

Keyword retrieval finds documents containing the terms and scores them with BM25. Semantic retrieval finds documents whose embeddings sit near the query's. Hybrid retrieval runs both and fuses the lists, which is now the standard because the two fail in opposite directions.

Stage 4 — Ranking

The candidate set is reordered by a scoring pass combining text relevance with availability, popularity, margin, recency and any merchandising rules. A cross-encoder re-ranker over the top candidates is the common modern refinement.

Stage 5 — Presentation

Results are grouped, filtered, and rendered with suggestions and facets — and, when nothing matched, with a recovery path rather than an empty page. Presentation decides whether good retrieval is actually experienced as good search.

Frequently asked

Where does website search usually break?
Indexing coverage and query understanding, in that order. Ranking gets most of the attention and causes far fewer visible failures.