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. ...