Skip to content

docs: make site search usable (scope to reader's language, stop one page filling results) - #15745

Open
devGregA wants to merge 3 commits into
DefectDojo:bugfixfrom
devGregA:devgrega/docs-search-language-filter
Open

docs: make site search usable (scope to reader's language, stop one page filling results)#15745
devGregA wants to merge 3 commits into
DefectDojo:bugfixfrom
devGregA:devgrega/docs-search-language-filter

Conversation

@devGregA

@devGregA devGregA commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Docs search returns results that are hard to use. Two of the causes are in this repo and are fixed here. The rest are in the Algolia crawler configuration and are written up at the bottom for whoever holds that access.

Fix 1: search every language at once

Querying jira against the live index returned, as the top five results:

[ja] /ja/connectors/os_jira/os__jira_guide/
[fr] /fr/connectors/os_jira/os__jira_guide/
[es] /es/connectors/os_jira/os__jira_guide/
[de] /de/connectors/os_jira/os__jira_guide/
     /connectors/os_jira/os__jira_guide/

Five of the first six slots were the same page in five languages. Nothing needs to change on the Algolia side, because the index already tags every record with a lang facet:

records: 17,557
facets:  lang, type, audience
lang:    en 4809 · ja 3188 · de 3187 · es 3187 · fr 3186

Every built page already emits the right <html lang>. The only missing piece was passing a facet filter at query time. The filter falls back to en if a page somehow renders without a lang attribute, so it degrades to today's English behaviour rather than returning nothing.

Fix 2: one page filling every slot

This one predates the translations. DocSearch groups results by section, not by page, so a single long page can occupy the whole result list. Searching reimport returned:

/import_data/import_intro/reimport/#main-content
/import_data/import_intro/reimport/#reimport-process-summary
/import_data/import_intro/reimport/#reimport-logic-create-ignore-close-or-reopen
/import_data/import_intro/reimport/#opening-the-reimport-form
/import_data/import_intro/reimport/#working-with-import-history

Five results, one page. The reader gets that page's table of contents instead of the five most relevant pages. This caps hits from any one page at two, which keeps the useful "page plus best matching section" pair and frees the rest of the list.

Still broken, needs crawler access

These cannot be fixed from this repo. The crawler config is not in version control and there is nothing in .github/ that touches Algolia, so it lives in the Algolia crawler UI. The index was last refreshed 2026-08-18, so the crawler itself is running fine.

  1. h3 headings are not indexed at all. The English docs use ### 926 times, and the index contains no lvl3 records whatsoever (only lvl1, lvl2, lvl4 and content). Heading IDs are generated correctly on our side (autoHeadingID = true, and built pages carry <h3 id=...>), so this is a selector problem in the crawler. Close to a thousand subsections are currently invisible as search targets, and lvl4 sections are being indexed while their lvl3 parents are skipped.

  2. Overview pages do not rank for their own topic. Searching import a scan returns Smart Upload, Universal Parser twice and Universal Importer twice, and never returns the import introduction. Someone searching the most obvious phrase gets the most advanced answers. This wants a ranking signal that favours introductory pages.

  3. Many records anchor to #main-content rather than the heading that actually matched, so clicking a result lands the reader at the top of a long page.

  4. Duplicated hierarchy labels, for example Deduplication > Location Drift Matching (Pro) (Pro) and Deduplication Tuning (Open Source) (Open Source), which looks like the page title and a crawler level both contributing the edition suffix.

  5. Every concept is documented twice, once for Open Source and once for Pro, and search returns both, so half the results are for the edition the reader is not running. The index already carries an audience facet (pro, opensource, public) that nothing currently uses. Filtering on it is possible from this repo, but it needs a product decision about the default, so it is deliberately not in this PR.

Verifying after deploy

Search from an English page and from a /fr/ page and confirm each stays in its own language, then search reimport and confirm the results are several different pages rather than one page repeated.

🤖 Generated with Claude Code

Every record in the DocSearch index already carries a lang facet and every
built page already emits <html lang>, but the search box never filtered on
it, so one query searched all languages at once.

The effect is worst on common terms. Searching "jira" returned the same
page in Japanese, French, Spanish, German and English as the top five
results, so five of the first six slots were copies of one page in
languages the reader cannot read. Adding a language filter at query time
gives the reader results in the language they are already browsing.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
DocSearch groups results by section rather than by page, so a single long
page could occupy every slot. Searching "reimport" returned five results
that were all subsections of the Reimport page, so the reader saw one
page's table of contents instead of the five best pages.

Cap the hits from any one page at two, which keeps the useful
"page plus best matching section" pair and frees the remaining slots for
other pages.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@devGregA devGregA changed the title docs: scope site search to the reader's language docs: make site search usable (scope to reader's language, stop one page filling results) Aug 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant