score_expr_bm25_optimized

Function score_expr_bm25_optimized 

Source
pub fn score_expr_bm25_optimized(
    expr: &Expr,
    params: &PrecomputedBm25Params<'_>,
) -> Option<f64>
Expand description

Recursively compute a doc’s “ES-like BM25 bool query” score from the AST using precomputed IDF values:

  • If it fails a must or matches a must_not => return None (exclude doc)
  • Otherwise sum up matched subclause scores
  • For “OR,” doc must match at least one side
  • For “AND,” doc must match both sides
  • For a “should” term, we add the BM25 if it matches; if the entire query has no must, then at least one “should” must match in order to include the doc.