Skip to main content

Module multi_term

Module multi_term 

Source
Expand description

Shared per-segment supplier for constant-score multi-term queries.

Used by prefix, wildcard, fuzzy, and regexp. Each calling query is responsible for enumerating its own matching terms in the segment (via terms_with_prefix, automaton_search, etc.); this module provides the post-enumeration scoring infrastructure:

  1. Open each term’s postings on demand (one FST lookup per term).
  2. Wrap in [FilterScorer] (no BM25 setup, no norms I/O).
  3. Union via BufferedUnionScorer (windowed bitset).

Both FilterScorer::score() and BufferedUnionScorer::score() return a constant 1.0 — matches Lucene’s MultiTermQueryConstantScoreBlendedWrapper semantics where the disjunction is wrapped in a ConstantScoreScorer.

See [[optimization-multiterm-constant-score-rewrite]] and [[fix-disjunction-heap-inefficiency]].