
IndexStats
- Namespace
- Rowles.LeanLucene.Search.Scoring
- Assembly
- Rowles.LeanLucene.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
IndexStats(int, int, Dictionary<string, float>, Dictionary<string, int>)
Initialises a new IndexStats with pre-computed corpus statistics.
Empty
An empty stats instance used for new or unreadable indexes.
LiveDocCount
Total number of live (non-deleted) documents across all segments.
TotalDocCount
Total number of documents across all segments (including deleted).
GetAvgFieldLength(string)
Returns the average field length for a given field, defaulting to 1.0f.

GetAvgFieldLengths()
Returns a copy of the average field lengths dictionary (for serialisation).
GetFieldDocCount(string)
Returns the number of documents containing the given field.

GetFieldDocCounts()
Returns a copy of the field doc counts dictionary (for serialisation).
GetStatsPath(string, int)
Builds the canonical stats file path for a given commit generation.
TryLoadFrom(string)
Tries to load persisted IndexStats from the given path. Returns null if the file does not exist or is corrupt.
WriteTo(string)
Serialises this IndexStats to a JSON file at the given path. Uses write-temp-then-rename for atomicity.