all2md.search.bm25
BM25 keyword search index backed by rank-bm25.
- class all2md.search.bm25.KeywordIndexConfig
Bases:
objectConfiguration settings for BM25 indexing.
- k1: float = 1.5
- b: float = 0.75
- __init__(k1: float = 1.5, b: float = 0.75) None
- class all2md.search.bm25.BM25Index
Bases:
BaseIndexKeyword search implementation using BM25 scoring.
Initialise the BM25 index with optional configuration and tokenizer override.
- backend_name = 'bm25'
- __init__(*, config: KeywordIndexConfig | None = None, tokenizer: Callable[[str], Sequence[str]] | None = None, index_id: str | None = None, options_snapshot: Mapping[str, object] | None = None) None
Initialise the BM25 index with optional configuration and tokenizer override.
- search(query: SearchQuery, *, top_k: int = 10) list[SearchResult]
Return the top
top_kchunks ranked by BM25 score forquery.
- save(directory: Path) None
Persist BM25 corpus, chunks, and configuration to
directory.