Section navigation

Public classSealed IndexStats

Namespace
Rowles.LeanCorpus.Search.Scoring
Assembly
Rowles.LeanCorpus.dll

Immutable corpus-wide statistics computed once at IndexSearcher construction. Shared across all segment readers so BM25 scores are comparable across segment boundaries.

public sealed class IndexStats
Inheritance
IndexStats

Public constructor IndexStats(int, int, Dictionary<string, float>, Dictionary<string, int>, Dictionary<string, long>)

Initialises a new IndexStats with pre-computed corpus statistics.

Public property Empty

An empty stats instance used for new or unreadable indexes.

Public property LiveDocCount

Total number of live (non-deleted) documents across all segments.

Public property TotalDocCount

Total number of documents across all segments (including deleted).

Public method GetAvgFieldLength(string)

Returns the average field length for a given field, defaulting to 1.0f.

Public method GetFieldDocCount(string)

Returns the number of documents containing the given field.

Public method GetFieldLengthSum(string)

Returns the total number of tokens in the collection for a given field, defaulting to 0.

Public method GetStatsPath(string, int)

Builds the canonical stats file path for a given commit generation.

Public method TryLoadFrom(string)

Tries to load persisted IndexStats from the given path. Returns null if the file does not exist or is corrupt.

Public method WriteTo(string)

Serialises this IndexStats to a JSON file at the given path. Uses write-temp-then-rename for atomicity.