Class Bm25Index
In-memory BM25 index for keyword-based document search. Uses Bm25Tokenizer for text tokenization. Thread-safe for concurrent reads and writes.
public class Bm25Index : IDisposable
- Inheritance
-
Bm25Index
- Implements
- Inherited Members
Constructors
Bm25Index()
public Bm25Index()
Properties
DocumentCount
Returns the number of indexed documents.
public int DocumentCount { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
Index(string, string)
Indexes a document. If a document with the same ID exists, it is replaced.
public void Index(string id, string text)
Parameters
Remove(string)
Removes a document from the index.
public void Remove(string id)
Parameters
idstringDocument identifier to remove.
Search(string, int)
Searches the index using BM25 scoring.
public IReadOnlyList<Bm25Index.Bm25Result> Search(string query, int topK)
Parameters
Returns
- IReadOnlyList<Bm25Index.Bm25Result>
BM25 results sorted by score descending.