Table of Contents

Public classSealed 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

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

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.

Internal methodInternal GetAvgFieldLengths()

Returns a copy of the average field lengths dictionary (for serialisation).

Public method GetFieldDocCount(string)

Returns the number of documents containing the given field.

Internal methodInternal GetFieldDocCounts()

Returns a copy of the field doc counts dictionary (for serialisation).

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.