Search That Works: Relevance Beyond Keyword Matching
Key takeaway
A SQL LIKE query is not search — it can't rank, tolerate typos, or handle word variants. A dedicated search index gives you relevance ranking, analyzers, and synonyms, and the work that actually improves results is tuning field weights and measuring zero-result queries, not swapping engines.
Search is often the most-used feature in an application and the least invested in. Users forgive a lot, but they don't forgive a search box that can't find something they know is there.
Why the database query isn't enough
- No ranking — every match is equal, so the best result appears wherever the sort order puts it.
- No tolerance for typos, plurals, or word stems: "running shoe" won't match "shoes for running".
- Leading-wildcard patterns can't use an index, so it degrades badly as data grows.
- No facets, highlighting, or synonyms without writing all of it yourself.
What a search index adds
- Relevance scoring, so the best match comes first and you can influence why.
- Analyzers — tokenisation, lowercasing, stemming, and stop-word handling per language.
- Fuzzy matching for typos, and synonym sets for the vocabulary differences between you and your users.
- Facets and filters for narrowing, and highlighting so users see why a result matched.
The tuning that actually moves the needle
- Field weighting — a match in the title should outrank a match buried in a description.
- Business signals in the ranking: popularity, recency, availability, or margin, blended with textual relevance.
- Synonyms drawn from your own query logs — including the words customers use that your catalogue doesn't.
- Sensible handling of multi-word queries: requiring all terms is usually better than any, with a graceful fallback.
Measure it
- Zero-result queries — the single most valuable list in search analytics. Each one is a user who failed.
- Click-through position: if users routinely click the fifth result, your ranking is wrong.
- Search-to-conversion rate compared with browsing, which tells you whether search is helping or obstructing.
- Query refinement rate — repeated rewording of the same query means the first attempt failed.
Keeping the index honest
The index is a derived copy, so plan how it stays current: event-driven updates for freshness, plus a periodic full rebuild to correct drift. And keep the database as the source of truth — a search index is for finding records, not for holding them.