Repository navigation
Make API group, type and topic pages searchable - #5043
Conversation
| Title = search.Title, | ||
| SearchTitle = search.Title, | ||
| Description = search.Description, |
There was a problem hiding this comment.
Severity: P3 (Low)
Preserve literal angle-bracket text when returning these new search hits. The added HTTP <code> responses fixture is indexed correctly, but the navigation search treats the raw <code> as markup and displays HTTP responses. Escape the text before adding highlight markup so the result matches the page title.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
Fixed by #5038, now merged on main, which this stack is rebased on. The search result processor encodes the title and description around its <mark> tags, so the row shows HTTP <code> responses.
Docs preview (local build)Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/5043/ |
ad94292 to
5e774fc
Compare
5e774fc to
c007ee2
Compare
Pages that are not operations had hidden, empty `sitemap_only` documents, so search never found them. Each such page now gets one visible `api.page` document: its front-matter title and description, and its Markdown export, which the indexer reads like an operation's body and takes section headings from. Skipped operations and excluded pages such as Servers keep their sitemap-only documents. The MCP operation tools and the API lookup keep these pages out unless every typed word is in their title. Co-Authored-By: Claude Opus 5.5 <[email protected]>
A page's search body is its export as readers get it, so a URL in prose no
longer shows as `{api-root}`. Version trees still collapse a page: its body
counts through its content hash, which reads links relative to the tree. The
collapse fingerprint also compares the path relative to the tree root, so
identical pages at different slugs stay separate documents.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
The collapse fingerprint compares a page body with its links read relative to its tree, instead of through the whitespace-normalized content hash. Two trees that lay a page out differently, such as a heading on its own line against the same text inline, keep their own search documents. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The collapse fingerprint takes a page body through its content hash again, the hash the sitemap dates the page by, so a page that shares a search document across versions also shares its `lastmod`. The path relative to the tree root still keeps pages at different slugs apart. Two versions that differ only in whitespace share one document; their indexed text is the same. Co-Authored-By: Claude Opus 5.5 <[email protected]>
c007ee2 to
4e4e970
Compare
| { | ||
| Path = "", | ||
| Path = doc.Path.StartsWith(root, StringComparison.Ordinal) ? doc.Path[root.Length..] : doc.Path, | ||
| Body = doc.Api.Page ? "" : doc.Body, |
There was a problem hiding this comment.
Severity: P3 (Low)
The sitemap hash is not enough to decide whether two versions can share a search document. It collapses all whitespace, so Authentication\n--- (a section heading) and Authentication\n\n--- (a paragraph followed by a rule) hash identically. When that is the only difference between versions of a topic, the indexer gets only the default version’s body and uses its headings and summary for both versions. Keep the sitemap hash for dating, but compare the tree-relative Markdown separately when collapsing search documents.
Generated by Libra. React with 👍 or 👎 to give feedback on this comment.
There was a problem hiding this comment.
Is it also possible to search of a specific property in a Type ?
There was a problem hiding this comment.
I'll add in the next pr
API group, type, topic, authentication and Markdown pages now appear in docs search and the API search box. A search for
Snapshot and restoreorauthenticationfinds the page itself, not only its operations.Closes elastic/docs-eng-team#1230
Affects: Search, API reference, MCP
Prompt summary: The author asks for the cleanest way to make non-operation API pages searchable (elastic/docs-eng-team#1230). This PR replaces #5036, whose review rounds kept patching how it guessed text from an ambiguous export.
Stack: 2 of 2, on top of #5042, which makes the export unambiguous.
Why
Since #4983, every non-operation API page has a search document only so the sitemap can date it. Those documents are
hidden: trueandapi.sitemap_only: true, with an empty body. Search, navigation search, the change feed and the MCP tools never return them. The page that answers a reader's query stays invisible.What
One searchable document per page
OpenApiGenerator.PageContentsAsyncgives search text to every page that is not an operation, not the landing page and not excluded from indexing. The search text is the page's front-matter title and description, already plain text since #5042, plus its Markdown export as readers get it.OpenApiDocumentExporter.DatedByPageturns that into a visibleapi.pagedocument withAPI > <Product> APIparents and the product. Each page still has one document with the same content hash, so the sitemap'slastmoddates do not move. Identical pages collapse across version trees as operations do.ApiTreeCollapseidentifies a page by its content hash and its path relative to the tree root, so pages at different slugs stay apart.Other pages stay date-only
Skipped operations, such as unreleased ones or aliases of a collapsed operation, and excluded pages such as Servers keep their hidden
api.sitemap_onlydocument. Thesitemap_onlyfilters stay, so the live index behaves correctly before and after the next indexing run.The indexer reads pages like operations
ElasticsearchMarkdownExporter.ApplyApiMarkdownparses an API document's Markdown once. It writes the plain-text body for every API document, and on a page document it also writes the section headings. No search-specific plain-text code is added.Search, MCP and result rows
The MCP operation tools (
ApiGateway.OperationFilter) excludeapi.pagedocuments, as they exclude landing pages.ApiLookupQueryBuilderkeeps landing and other pages out unless every typed word is in their title, so a type page that lists every property does not match most property queries. Navigation search returnspage, and a row for one of these pages reads "Go to page".Risk: the index mapping gains
api.page. The next indexing run writes about 570 more documents with a real body, and AI enrichment and semantic inference run on them.Out of scope:
SearchRelevanceTestswere not run against the dev index. Run them before and after to measure how group and type pages compete with operations on short queries.Review rules
These settle trade-offs that review findings can pull either way. A finding that breaks one is a bug; one that asks to trade against it is out of scope.
lastmodalways agree. Versions that differ only in whitespace share one document.Verify
Check on the preview
The preview has no search backend (its
/docs/_apireturns 404), so the search box cannot show these pages there. Each page's search document is built from its Markdown export: the front matter gives the title and description, and the body becomes the indexed text and section headings. These exports show what each page contributes to the index.authentication.🤖 Generated with Claude Code