Bm25Retriever#
- class scikitplot.mcp.Bm25Retriever(fts_search, doc_lookup, *, strict=False)[source]#
Lexical retriever (FTS/BM25) leg backed by a full-text search seam.
- Parameters:
- fts_searchcallable
(query, k) -> list[(doc_id, score)]— BM25-ranked hits. In production this wrapsscikitplot.corpus.SQLiteStorageFTS5 (whose default rank is BM25).- doc_lookupcallable
doc_id -> mappingwith at leasttextandsource_uri.
- Parameters:
Notes
BM25 complements dense retrieval on exact tokens — API symbols, flags, error messages — that embeddings often blur.
- classmethod from_corpus_sqlite(storage_path, *, strict=False)[source]#
Build from a corpus SQLite/FTS5 store (import-guarded).
Wires
scikitplot.corpus.SQLiteStorage.search_text: BM25-ranked retrieval over free text. RaisesRuntimeErrorwith an actionable message if corpus is absent.Notes
Developer. This leg used to pass the query to
StorageQuery.full_text, which reached FTS5MATCHverbatim as an expression and required every word:roc_auc_score(),C++,random-stateand any pasted error message were FTS5 syntax errors, and a plain question returned nothing, so hybrid search quietly ran on its dense leg alone (finding CX-01).search_textnever reads the query as syntax, matches any word, and returns the BM25 score itself rather than1 / rank.- Parameters:
- Return type:
- search(query, k=5)[source]#
Run FTS5/BM25 and map hits to
RetrievedChunk.- Parameters:
- Return type: