Skip to main content
QUICK REVIEW

[Paper Review] Integrating the Probabilistic Models BM25/BM25F into Lucene

Joaquín Pérez-Iglesias, José R. Pérez-Agüera|ArXiv.org|Nov 26, 2009
Information Retrieval and Search BehaviorComputer Science71 citations
TL;DR

This paper presents an implementation of the BM25 and BM25F probabilistic retrieval models within the Apache Lucene search engine framework. It enhances Lucene’s ranking by integrating BM25 for unstructured text and BM25F for structured documents, using term frequency, inverse document frequency, and field-specific normalization with configurable parameters like k₁ and b, significantly improving retrieval relevance for IR researchers and practitioners.

ABSTRACT

This document describes the BM25 and BM25F implementation using the Lucene Java Framework. Both models have stood out at TREC by their performance and are considered as state-of-the-art in the IR community. BM25 is applied to retrieval on plain text documents, that is for documents that do not contain fields, while BM25F is applied to documents with structure.

Motivation & Objective

  • To address the lack of advanced probabilistic retrieval models in Lucene, which limits its adoption in academic and industrial IR research.
  • To implement BM25 and BM25F as first-class ranking functions within Lucene’s query processing pipeline.
  • To enable support for both plain-text (BM25) and semi-structured documents (BM25F) with field-level weighting and normalization.
  • To provide extensible, configurable parameters (k₁, b, boost, average field length) for tuning retrieval performance.
  • To ensure compatibility with Lucene’s existing Query-Weight-Scorer architecture while maintaining high performance and scalability.

Proposed method

  • Developed new Query, Weight, and Scorer classes—BM25BooleanQuery, BM25TermScorer, and BM25FTermScorer—extending Lucene’s core search architecture.
  • Implemented BM25 scoring using the standard probabilistic formula: R(q,d) = Σ[idf(t) × (tfₜᵈ / (k₁((1−b) + b×(l_d/avl_d)) + tfₜᵈ))], with k₁=2 and b=0.75 by default.
  • Extended BM25 to BM25F by computing field-specific weights: weight(t,d) = Σ_c [ (occursₜ,ₜᶜᵈ × boost_c) / ((1−b_c) + b_c×(l_c/avl_c)) ], followed by non-linear saturation: weight/(k₁ + weight).
  • Calculated IDF as log((N−df(t)+0.5)/(df(t)+0.5)), where N is total document count and df(t) is document frequency.
  • Introduced a custom Similarity class (CollectionSimilarityIndexer) to compute and persist average document and field lengths at index time.
  • Provided a configuration mechanism via BM25Parameters and BM25FParameters to load average lengths and set parameters (k₁, b, boost) from external files or programmatic input.

Experimental results

Research questions

  • RQ1How can the BM25 probabilistic retrieval model be effectively integrated into the Apache Lucene search engine framework?
  • RQ2What architectural changes are required to support field-level scoring and normalization in BM25F within Lucene’s existing query processing pipeline?
  • RQ3How can document and field average lengths be efficiently computed and persisted at index time to support BM25/BM25F scoring?
  • RQ4Can BM25F support structured documents with multiple fields by applying field-specific weights and normalization parameters?
  • RQ5What is the impact of configurable parameters (k₁, b, boost) on retrieval effectiveness when using BM25/BM25F in Lucene?

Key findings

  • The implementation successfully integrates BM25 and BM25F into Lucene’s core search pipeline using a modular extension of the Query-Weight-Scorer pattern.
  • BM25F supports semi-structured documents by computing field-specific term weights and applying non-linear saturation to reduce term frequency bias.
  • Average document and field lengths are computed at index time via a custom Similarity class and persisted externally for use at search time.
  • The system allows runtime configuration of k₁, b, boost, and average lengths through dedicated parameter classes, enabling flexible tuning.
  • The implementation supports both boolean query filtering and probabilistic scoring, with all scoring logic delegated to the Scorer layer.
  • The approach enables direct comparison with other IR systems (e.g., Terrier, Lemur, Xapian) by exposing advanced ranking models within Lucene’s ecosystem.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.