--- id: llama-index-retrievers-bm25 version: "0.7.1" license: MIT license_treatment: permissive maintenance: active --- # llama-index-retrievers-bm25 — llama-index retrievers bm25 integration License: permissive · Maintenance: active · Downloads: 326.3K/mo ## What it is and what it does This package provides a BM25-based retriever for LlamaIndex, a framework for building retrieval-augmented generation (RAG) applications. BM25 is a probabilistic ranking function that scores documents based on keyword relevance, making it useful for traditional full-text search within LlamaIndex pipelines. The retriever accepts a collection of documents, builds an index using the bm25s library, and returns ranked results for text queries. It sits between your document collection and LlamaIndex's query pipeline, handling the retrieval step without requiring external search infrastructure. The package depends on bm25s for the core ranking algorithm, llama-index-core for integration hooks, and pystemmer for linguistic preprocessing. It's designed for developers who want keyword-based retrieval as part of a larger LlamaIndex application, particularly when semantic or hybrid search isn't the primary need. Use it for: - Build a RAG pipeline where keyword matching is the primary retrieval strategy before passing results to an LLM. - Add full-text search to a document Q&A system without setting up a separate search engine. - Combine BM25 retrieval with other LlamaIndex retrievers in a hybrid or ensemble approach. - Index and retrieve from domain-specific documents where exact keyword matches are important. - Prototype or test retrieval logic quickly without infrastructure overhead. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Integrates BM25 full-text search retrieval into LlamaIndex applications, enabling keyword-based document ranking and retrieval without external dependencies. Yes, if you're building a LlamaIndex application and need straightforward keyword-based retrieval. The low install friction, active maintenance, MIT license, and zero known vulnerabilities make it a safe choice. Install only if BM25 ranking fits your retrieval needs; for semantic or dense vector search, you'd want a different retriever. ## Install pip install llama-index-retrievers-bm25 uv add llama-index-retrievers-bm25 poetry add llama-index-retrievers-bm25 ## Installing llama-index-retrievers-bm25 Before you install: Low install friction with a pure-Python wheel and only three runtime dependencies. Actively maintained as of March 2026, with no known security vulnerabilities. License in practice: MIT license permits unrestricted use, modification, and distribution in both open-source and commercial projects, with only attribution required. Quickstart: pip install llama-index-retrievers-bm25 from llama_index.retrievers.bm25 import BM25Retriever retriever = BM25Retriever.from_documents(documents) results = retriever.retrieve(query_str) Requires Python 3.10 or later (supports current versions up to <4.0). Verify before relying: - Whether BM25Retriever integrates seamlessly with other LlamaIndex components beyond core retrieval. - Performance characteristics when indexing or querying large document collections. - How pystemmer is used internally and whether stemming behavior is configurable. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 326.3K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags bm25 retrieval llama index, keyword search document ranking, full-text search integration, bm25 ranking algorithm, llama index retriever plugin, text-based document retrieval, information retrieval bm25, retrieval-augmented-generation, information-retrieval, llama-index-integration [View on SkillFed](https://skillfed.io/packages/llama-index-retrievers-bm25) · [View on PyPI](https://pypi.org/project/llama-index-retrievers-bm25/)