If readers search your documentation and then search Google for the same thing, your search is broken, and it is almost always broken in one of three ways. It indexes headings and titles but not the sentence that actually answers the question. It does not know that the word your readers use is not the word you use. Or it opens a separate results page, which costs enough that people stop trying. All three are fixable in an afternoon each, and none of them require replacing your search engine.
Why documentation search fails
Site search on a documentation site is an unusual problem. The corpus is small (hundreds of pages, not millions), the queries are short and highly technical, and the reader almost always has a specific page in mind rather than a topic to browse. That combination means relevance ranking matters far less than coverage and vocabulary, which is the opposite of what general search advice assumes.
- Partial indexing. Many setups index the title, the headings and the first paragraph. The answer to “what is the maximum page size” is in the eleventh paragraph, and it is invisible.
- Vocabulary mismatch. Your docs say “workspace”; your readers type “org”. Your docs say “rate limit”; your readers type “429”. No amount of ranking fixes a term that appears nowhere in the index.
- Interaction cost. A search box that navigates to a results page, loses the reader’s place, and requires a back button to try again is a search box people use once.
- No result is still a result. An empty state that says “No results” and nothing else is a dead end. It should offer the nearest matches, the section index, and a way to report the gap.
Index the whole page, not just its skeleton
Index the full body text of every page. On a documentation site the corpus is small enough that this is cheap, and the specific sentence a reader is looking for is usually deep inside a page rather than in its title.
Two refinements are worth the effort. Weight the title and headings above body text, so an exact page match still wins. And index each section separately where you can, so a hit can link to the anchor rather than to the top of a four-thousand-word page. Landing a reader on the right page and leaving them to scroll is only half an answer.
Developers search for the function name, the error string, the config key. If your index strips code blocks (and many do, on the reasonable-sounding grounds that code is not prose), you have removed the exact strings your readers are most likely to paste into the box.
Teach it the words your readers actually use
This is the highest-return change available and almost nobody makes it. Take your search logs, find the queries returning nothing, and turn each one into a synonym. Twenty entries covers most of the gap.
{
"synonyms": {
"sso": ["single sign-on", "saml", "oidc"],
"api key": ["token", "credential", "secret"],
"rate limit": ["throttle", "429", "too many requests"],
"deploy": ["ship", "release", "roll out"]
}
}Three families of synonym are worth seeding before you have any logs at all: error codes and messages mapped to the feature that emits them, the terms your competitors use for the same concept, and the abbreviations your own team uses in conversation but never in writing.
It is tempting to sprinkle the alternative terms through the page so search finds them. Resist. Prose written for a search index reads badly for humans and eventually for machines too. Keep one term in the writing (that is what your style guide is for) and put the alternatives in the index.
The interface details that decide whether people use it
Search behaviour is decided by small frictions. These five are the ones that show up in session recordings.
Client-side or hosted?
For a documentation site under a few thousand pages, a client-side index is usually the better trade. The whole index downloads once, every subsequent search is instant with no network round trip, there is no third-party service to pay for or to disclose in your privacy policy, and nothing breaks when their status page goes red.
| Client-side index | Hosted search service | |
|---|---|---|
| Latency | Zero after the index loads | One network round trip per query |
| Scale ceiling | Comfortable to a few thousand pages | Effectively unlimited |
| Typo tolerance | Basic, depending on the library | Good, and usually tunable |
| Cost | None | Per query or per record, and it grows with traffic |
| Privacy | No queries leave the browser | Every query goes to a third party |
| Analytics | You have to instrument it yourself | Included, and usually good |
The honest catch with a client-side index is the first load. A large index downloaded synchronously before the box works makes the first search of a session feel slow, which is the search that matters most. Fetch it lazily on first focus, page it if it is large, and show progress rather than an empty box.
Measure whether it is working
Three numbers tell you almost everything, and all three are cheap to collect even with a client-side index.
- Zero-result rate. Every zero-result query is either a missing synonym or a missing page. Both are actionable, and the list is usually short enough to read by hand each month.
- Click-through rate on the first result. If it is low, your ranking is wrong. If it is high but readers search again immediately, the page they landed on did not answer the question.
- Search-then-leave rate. Readers who search and then close the tab found nothing, and they will not tell you.
Read the raw query log too, not just the aggregates. Twenty minutes with the actual strings people typed will tell you more about what your documentation is missing than any dashboard, and it feeds directly into measuring the docs as a whole.
Common questions
Should search cover the blog and the marketing site too?
No. Someone searching inside documentation is trying to do a task, and a blog post from three years ago competing with the reference page actively harms them. Keep the scopes separate; if you must combine them, group results by source and put documentation first.
What about search for versioned documentation?
Index only the current version by default and let the version selector do the rest. A reader searching from inside v2 should get v2 results, but the default scope for someone arriving cold is the version almost all of them are running.
Is it worth adding AI answers on top of search?
Only once retrieval is good, because a generated answer over a bad index is a confident wrong answer. Fix indexing and synonyms first: that work also makes your pages easier for external assistants to quote correctly, which is covered in Writing Documentation That AI Assistants Cite Correctly.
Doku indexes the full text of every doc server-side, caches it, invalidates on edit, and searches it in the browser with FlexSearch behind a Ctrl + K overlay, with no third-party service and no queries leaving the reader’s machine. See Features.