fastrag.lexical_store.base#
The LexicalStore contract: BM25 search over stored document text.
Deliberately independent of VectorStore.
Lexical and dense retrieval are separate capabilities, so neither forces the
other on a backend:
A vector database with server-side BM25 inherits both (
class MilvusVectorStore(VectorStore, LexicalStore)) and one open store answers both branches of aHybridRetriever.A vector database without it implements only
VectorStore; BM25 then comes from a different backend implementing onlyLexicalStore— dense vectors in Milvus, say, and lexical ranking in PostgreSQL.
BM25Retriever depends on this contract only,
never on a backend client.
Classes
Storage able to rank its documents' text against a query with BM25. |
- class fastrag.lexical_store.base.LexicalStore[source]#
Bases:
ABCStorage able to rank its documents’ text against a query with BM25.
Opened and closed by the caller, like a vector store — a retriever holds an already-open one and never manages its lifecycle.