Repository navigation
Site search fails code-like queries (symbols, code tokens, stopwords, typos) #1972
Description
What information was incorrect, unhelpful, or incomplete?
Site search (/en-US/search) returns no results, or buries the canonical page, for queries that developers type as code:
- Symbols and operators return zero results, even where the page title contains the symbol:
%("Remainder (%)"),!,?,~,*,@,#,!!,${},::. The index strips punctuation, so these queries have no tokens left to match. - Code tokens in prose don't help ranking:
max-agedoesn't surfaceCache-Control, and::before,:has()or@mediarank their reference pages low or not at all. - Exact API names that are stopwords return zero results:
a(the<a>element) andthen(Promise.prototype.then()). - Typos, plurals and compound words return zero results:
adress,lenght,localcompare,eventlisteners,webworker.
In site search measurements from 4 weeks in September 2026, 22 of the 39 most frequent zero-result queries (about half of those searches) have a matching MDN page. Most of the rest are topics MDN doesn't cover, where zero results is correct.
What did you expect to see?
- Symbol and operator queries find the operator, selector or syntax page (e.g.
%→ Remainder,${}→ Template literals,::→ pseudo-elements). - Code tokens rank the page that documents them first (e.g.
max-age→Cache-Control). - Exact API names match, even when they are common words.
- Near-miss spellings still find the intended page when the exact query has no results.
- No regressions for plain-word queries (e.g.
html,fetchandflexboxkeep their current top results).
Do you have any supporting links, references, or citations?
Related to:
- Searching for
max-ageto find information aboutcache-controldoesn't work well #1577 - Search prioritizes article title too much #621
- Helping users with !, $, *. and certain other characters not indexed in the help system. dex#93
- Unable to search for
::dex#94
Do you have anything more you want to share?
A fix needs changes in both Dex (index fields) and Rumba (query):
- Index inline code, and add title fields that keep punctuation.
- Apply the inline-code and symbol matching only to code-like queries, so plain-word queries are unaffected.
- Add a fallback query (fuzzy matching, exact API names) that runs only when the main query returns no results.
In a local evaluation against the same measurements, this fixes 17 of the 22 queries above, with no measurable change to how high clicked results rank for other queries. The as-is version of mdn/rumba#885 regresses plain-word queries significantly, which is why the matching needs to depend on the query's shape.
The quick search in the header uses a separate client-side title index and is out of scope here.
Activity