Table of Contents

Class Bm25Index

Namespace
Mythosia.VectorDb.InMemory
Assembly
Mythosia.VectorDb.InMemory.dll

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

int

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

id string

Document identifier.

text string

Document text content.

Remove(string)

Removes a document from the index.

public void Remove(string id)

Parameters

id string

Document identifier to remove.

Search(string, int)

Searches the index using BM25 scoring.

public IReadOnlyList<Bm25Index.Bm25Result> Search(string query, int topK)

Parameters

query string

The search query text.

topK int

Maximum number of results to return.

Returns

IReadOnlyList<Bm25Index.Bm25Result>

BM25 results sorted by score descending.