Lucene's Search Execution: impacts, WAND and MAXSCORE

The previous post covered the performance fight. This one goes inside the executor: how a query runs from Weight to Scorer to DocIdSetIterator, and what impacts, WAND and MAXSCORE each solve. 1. The execution skeleton Lucene executes a query as a tree: Query → Weight (reusable scoring logic) → Scorer (one per segment) → DocIdSetIterator (iterate docs) + score function Weight: segment-independent “how to score”; Scorer: segment-specific “which docs to score”; DISI: only nextDoc() / advance(doc). The naive execution: walk each clause’s postings, intersect/union, score each doc. Slow but correct. ...

October 20, 2026 · 3 min · daviszhen

Rewriting Lucene in C++ (Part 3): From 128 to 592 QPS — The Search Performance Fight

The first two posts were about “is it right.” This one is about “is it fast” — and not a 10% difference, but 5x. 1. Baseline: 128 vs 634 QPS 1M docs, luceneutil task set, Top-10: Scale C++ Java 250K docs 483 QPS 1,886 QPS 1M docs 128 QPS 634 QPS The gap isn’t constant — it grows with data size, which means the bottleneck is the per-document processing path, not startup overhead. ...

October 20, 2026 · 4 min · daviszhen