--- title: "How to Add Search to Your Documentation" canonical: https://supportpages.io/guides/add-search-to-your-documentation updated: 2026-08-13 --- You will finish with working search over your documentation, tuned for the phrasings your readers use rather than the ones your articles are written in, and a log of every query that found nothing. That log is the most valuable output here: it is a ranked list of what to write next, generated by the people who needed it. ## Before you start Count your published articles and find out how your site is built. A statically generated site and a database-backed help centre have different options, and the article count decides whether an index shipped to the browser is reasonable or absurd. Both facts take two minutes to establish and they determine every choice below. ![A query passing through matching, ranking and a zero-result fallback.](/images/guides/figures/add-search-to-your-documentation.webp) *The third box is the one that decides what a failed search feels like.* ## Steps 1. **Pick the index that matches your corpus size.** Under about a hundred articles, a client-side index built at publish time - Pagefind, Lunr, FlexSearch or similar - is enough and requires no service. Above that, the index outgrows what is reasonable to send to a browser, and a hosted search service becomes the sensible option. 2. **Index the full body, not only titles and headings.** Title-only search fails on exactly the queries that matter, because readers search for the error message or the button label, and those appear in the body. 3. **Weight the fields deliberately.** Title highest, headings next, body lowest. Without weighting, a passing mention in a long article outranks the article whose title is the query. 4. **Build a synonym map from your own vocabulary gaps.** Every product has them: users say "cancel", your interface says "deactivate". Map both directions. This is the highest-value tuning available and most search implementations skip it entirely. 5. **Show a snippet with the query terms in context.** A results list of bare titles makes the reader open three pages to find out which one is relevant. A snippet showing the matching sentence removes most of that guessing. 6. **Show which section each result belongs to.** The category is context. It is how a reader tells the billing article from the account article when both titles look plausible. 7. **Put the input where readers expect it and make it keyboard-reachable.** Top of the page, visible without scrolling, focusable with a keyboard shortcut. Search is the primary navigation for most help centre sessions, so treating it as a secondary control fights the behaviour you have. 8. **Log every query, and flag the ones returning nothing.** Store the query text, the result count and the page it was run from. Zero-result queries are the whole reason to keep the log. 9. **Design the empty state properly.** Instead of "No results", offer your most-read articles and a route to a human. A dead end at this moment is the most reliable way to generate a support ticket you were trying to avoid. 10. **Review the zero-result log monthly.** Every entry is either a missing article, a missing synonym, or a spelling variant to handle. Two of those three take minutes to fix. ## Common mistakes **Indexing titles only.** It fails on the highest-intent query type there is - someone pasting an error message - and it fails silently, because the search box still returns things for common words. **Shipping a large client-side index.** A few hundred kilobytes of index downloaded by every visitor to make search work for the small fraction who use it is a poor trade, and it lands on the mobile visitors who can least afford it. **No synonym handling.** Readers use their own words, not your interface's. Without a map, search fails for the second-most-natural phrasing of nearly every question, and nobody reports it because failed search feels like their own fault. **Discarding queries.** Search logs are the cheapest documentation research you will ever have. Not storing them means paying for the same insight later through support tickets. **Requiring an exact match.** Typos and plurals are normal input. Whatever you choose should tolerate a character or two of difference, or the log will fill with near-misses that would have matched. ## When this stops scaling Client-side search holds to roughly a hundred articles, or an index of a few hundred kilobytes, whichever you hit first. Past that the download cost stops being defensible and the ranking quality of the small libraries starts to show on ambiguous queries. Hosted search moves the threshold up considerably, and the next limit is relevance tuning. Synonym maps, boosts and stop words are hand-maintained lists, and they need attention every time the product renames something. At a few hundred articles across several teams, nobody owns that list and it stops being updated - at which point search quality drifts down slowly enough that no one notices. The last limit is [the one search cannot fix](/blog/search-is-not-enough-anymore). If the query log shows people searching for something you have not written about, no amount of index tuning helps, and the zero-result list keeps growing faster than anyone writes. [SupportPages](https://supportpages.io) records the questions a help centre could not answer and treats that list as the article backlog, which is what the zero-result log is for. Until you are past a hundred articles, a generated client-side index and a monthly look at that log will serve you perfectly well.