Skip to content

feat: Add partial reindexing#225

Open
Pringled wants to merge 4 commits into
mainfrom
partial-reindexing
Open

feat: Add partial reindexing#225
Pringled wants to merge 4 commits into
mainfrom
partial-reindexing

Conversation

@Pringled

@Pringled Pringled commented Jul 16, 2026

Copy link
Copy Markdown
Member

This PR adds partial reindexing support. BM25s is dropped in favor of a custom BM25 implementation that supports adding/removing documents without full rebuilds. Results on our benchmarks:

Metric Before After Change
NDCG@10 0.8519 0.8519 No change
Cold index build 836 ms 809 ms 3.2% faster
Warm query p50 1.69 ms 2.33 ms 38% slower
Warm query p90 6.53 ms 7.41 ms 13% slower

The scores are basically the same. Queries are a bit slower but still so fast that I don't think it matters. Now the big improvement, tested on Zig (one of the larger repos in our benchmark):

Operation Before After Change
Rebuild after one changed file 8.47 s 369 ms ~23x faster

@codecov

codecov Bot commented Jul 16, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/semble/cache.py 100.00% <100.00%> (ø)
src/semble/index/bm25.py 100.00% <100.00%> (ø)
src/semble/index/create.py 100.00% <100.00%> (ø)
src/semble/index/index.py 100.00% <100.00%> (ø)
src/semble/index/types.py 100.00% <100.00%> (ø)
src/semble/search.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@greptile-apps

greptile-apps Bot commented Jul 16, 2026

Copy link
Copy Markdown

Confidence Score: 4/5

Safe to merge; the incremental reindex logic is well-designed and thoroughly tested, with no observed correctness issues in the happy path.

The core indexing and search paths are correct, the cache validation is thorough, and the test suite covers the main edge cases. All observations are non-blocking: BM25 IDF uses the full document count rather than the scored-document count (an API fragility, not a current bug), the not raw_manifest guard is marginally too broad, and the location field removal from chunks.json is a deliberate format change guarded by the version bump.

src/semble/index/bm25.py — the corpus_size vs doc_order length discrepancy is worth reviewing if the BM25 class is ever used outside the indexing pipeline. src/semble/cache.py — the not raw_manifest guard in load_previous_for_incremental.

Reviews (1): Last reviewed commit: "Optimizations" | Re-trigger Greptile

Comment thread src/semble/index/bm25.py
Comment thread src/semble/cache.py
Comment thread src/semble/index/index.py
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.

1 participant