Skip to content

index: preserve overlapping file rank penalties - #1164

Merged
keegancsmith merged 1 commit into
mainfrom
k/rank-fix
Sep 9, 2026
Merged

keegancsmith merged 1 commit into
mainfrom
k/rank-fix

Conversation

@keegancsmith

Copy link
Copy Markdown
Member

April’s indexing optimization (#1036) reused a single precomputed category for ranking, losing overlapping penalties such as generated tests. Compute independent rank flags alongside the category before discarding skipped content, keeping ranking cheap without growing Document on amd64.

The index format stays unchanged. Merge/explode retain stored categories (as fixed in #1073) and document order; regression tests cover that round trip and skipped-content handling.

Precomputed file categories retain only the first matching classification, so generated tests and similar overlaps lost ranking penalties after the indexing optimization. Compute independent ranking flags alongside the category before skipped content is discarded, keeping ranking cheap without having to reconstruct classifications later.

The flags fit in existing Document padding on amd64 and are only needed for initial shard ordering. Keep the persisted category and index format unchanged: merge and explode preserve stored categories and relative document order rather than re-ranking reconstructed documents.

Amp-Thread-ID: https://ampcode.com/threads/T-01a06c1b-9f70-777d-949b-61443d2d73c1
Co-authored-by: Amp <amp@ampcode.com>
@keegancsmith
keegancsmith marked this pull request as ready for review September 6, 2026 15:43
@keegancsmith
keegancsmith requested review from a team and stefanhengl September 6, 2026 15:43
Comment thread index/builder.go
Comment on lines +643 to +644
b.todo = append(b.todo, &doc)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is minor from a previous PR that landed. Logically it makes sense to only add the doc once we are done with it. The order we did it before was fine since we mutated a reference to do. But it feels like a bug waiting to happen having mutations to doc after we append it to TODO.

@keegancsmith
keegancsmith merged commit 3fd4304 into main Sep 9, 2026
7 checks passed
@keegancsmith
keegancsmith deleted the k/rank-fix branch September 9, 2026 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants