Skip to content

Remove the two-reading API parse the per-word lookup replaced - #4700

Merged
reakaleek merged 6 commits into
mainfrom
api-search/drop-readings
Nov 4, 2026
Merged

reakaleek merged 6 commits into
mainfrom
api-search/drop-readings

Conversation

@reakaleek

Copy link
Copy Markdown
Member

SearchQueryBuilder loses the API-only branches that the per-word lookup in the layer below made dead: the loose partial match, ApplyApiRanking, the api type filter in the reading parse, the prefix and children options of a reading, and the tests that covered them. Nothing changes for readers; the docs-wide search keeps its identifier field reading exactly as before.

Affects: Search

Prompt summary: The API search box ranks search retriever perfectly but returns bogus results for cluster flat_settings and nothing useful for es|ql drop_null_columns. Asked why, and then asked to design the fix properly instead of patching the rule, the work became a per-token query model delivered as a stack of three changes. This is the top layer, the deletion of what the new query replaced.

Why

After the layer below, type=api requests never reach the reading parse, so its API-only paths have no caller. Leaving them in would keep two models of the same query alive and invite the next change to patch the wrong one.

What

One lookup for the docs-wide readings

A docs-wide reading always used no prefix and no children; it now says so through one fixed DocsWideLookup, and the api branches that chose otherwise are gone. The loose 75 percent clause and the bare-word endpoint lift for API queries are deleted with the method that applied them, since the per-word lookup has both natively.

Tests follow the behaviour

The children-row result tests move to the API lookup's own result path, which is the only place children are listed now, with their assertions unchanged. Six cases that only the old reading tests covered (exact and prefix name matches with bounded scores, the qualified path, the parent key of the children option, what a trailing dot keeps) are added against the new builder before the old ones go. The remaining reading tests run docs-wide only.

Verify

dotnet test tests/Elastic.Documentation.Api.Tests/
grep -rn "ApplyApiRanking\|BuildLoosePartialMatchQuery\|IsApiLookup" src tests tests-integration
# the grep prints nothing

Out of scope: BuildApiPropertyQuery keeps its typeFilter parameter for its test callers; a later cleanup can drop it.

Stack: 3 of 3, on top of #4699, which sits on #4698.

🤖 Generated with Claude Code

@reakaleek
reakaleek added this pull request to stack #4701 November 4, 2026 21:59
@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

Docs preview (local build)

Handbook preview: https://docs-v3-preview.elastic.dev/elastic/docs-builder/pull/4700/

@reakaleek
reakaleek force-pushed the api-search/drop-readings branch from 4c71216 to 90382af Compare November 4, 2026 22:34
Base automatically changed from api-search/token-roles to main November 4, 2026 22:35
reakaleek and others added 6 commits November 4, 2026 23:35
The API lookup requires two words and then three quarters of them on its own, so `ApplyApiRanking` and `BuildLoosePartialMatchQuery` have no caller left.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Only the API lookup lists a typed path's children now, so the children ordering cases run with `ApiLookup` set and the word resolved to the field role. Their assertions are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reading tests in `ApiPropertySearchTests` held the only checks of these shapes. Moving them onto `ApiLookupQueryBuilder.Build` lets the API branches of the reading code go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`ApiLookupQueryBuilder` serves the `api` filter, so the readings no longer branch on it. `IsApiLookup`, `Lookup` and `SearchQueryBuilder.ExpandsChildren` go, a reading always uses the docs-wide lookup, and only the API lookup sets `ListChildren`. Docs-wide queries are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The docs-wide search still builds a marked-endpoint lift and two readings with distinct inner-hit names. Dropping the api-filtered tests removed the only coverage of both.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
`GET /_search knn` is two tokens now that the method joins its path, so the
`knn` word sits at index 1, not 2.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@reakaleek
reakaleek force-pushed the api-search/drop-readings branch from 90382af to cd1d49e Compare November 4, 2026 22:35
@reakaleek
reakaleek merged commit 457c57c into main Nov 4, 2026
19 checks passed
@reakaleek
reakaleek deleted the api-search/drop-readings branch November 4, 2026 22:37

This branch was successfully deployed

2 active deployments
docs-preview — cd1d49e6 Deployed Nov 4, 2026 by github-actions[bot]
assembler-preview — cd1d49e6 Deployed Nov 4, 2026 by github-actions[bot]
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