Table of Contents

Public classSealed IndexSearcher

Namespace
Rowles.LeanLucene.Search.Searcher
Assembly
Rowles.LeanLucene.dll

Holds a snapshot of segment readers and executes queries across all segments.

public sealed class IndexSearcher : IDisposable
IndexSearcher

Public constructor IndexSearcher(MMapDirectory, ISimilarity?)

Initialises a new IndexSearcher by loading the latest committed segments from the given directory.

Public constructor IndexSearcher(MMapDirectory, IndexSearcherConfig)

Initialises a new IndexSearcher by loading the latest committed segments from the given directory.

Public constructor IndexSearcher(MMapDirectory, IReadOnlyList<SegmentInfo>, ISimilarity?)

Initialises a new IndexSearcher over the given pre-built segment list (NRT or snapshot scenario).

Public constructor IndexSearcher(MMapDirectory, IReadOnlyList<SegmentInfo>, IndexSearcherConfig)

Initialises a new IndexSearcher over the given pre-built segment list with the specified configuration.

Public field t_collectorHeapCache

Public field t_docFreqTermsBuf

Public field t_fallbackCandidateIds

Public field t_fallbackInCandidate

Public field t_fallbackInClause

Public field t_fallbackInUse

Public field t_fallbackScores

Public field t_postingsBuffer

Public property Cache

The query result cache, or null if caching is disabled.

Public property Metrics

The metrics collector for this searcher.

Public property Stats

Corpus-wide statistics computed at construction.

Public method Dispose()

Disposes all underlying segment readers.

Internal methodInternal ExecuteMoreLikeThis(MoreLikeThisQuery, int)

Public method Explain(TermQuery, int)

Explains the score computation for a specific document and query. Returns null if the document does not match the query.

Public method Explain(VectorQuery, int)

Explains the score and execution strategy for a VectorQuery against a specific document. Surfaces the chosen ANN strategy (flat scan, HNSW two-phase, brute-force filter, HNSW pre-filter, HNSW post-filter), the configured ef, and shortlist size. Returns null if the document does not exist or has no vector for the query field.

Public method GetIndexSize()

Calculates the on-disk size of the index.

Public method GetStoredFields(int)

Retrieves stored fields for a global document ID.

Public method MoreLikeThis(int, string[], int, MoreLikeThisParameters?)

Convenience API: finds documents similar to the given document. Extracts significant terms from term vectors and re-queries the index.

Public method Search(Query, int)

Executes a query and returns the top-topN scoring documents. Checks the query cache first, then falls back to the full search pipeline.

Public method Search(Query, int, SortField)

Searches with a custom sort order instead of relevance ranking. Matching documents are collected and then ordered by the requested field.

Public method Search(Query, int, CancellationToken)

Searches with cancellation support. Checks the token between segments and between inner sub-clauses, allowing long-running queries to be interrupted.

Public method Search(string, string, int, IAnalyser?)

Parses a query string, applies analysis, and searches.

Public method Search(string, string, int, IAnalyser?, CancellationToken)

Parses a query string and searches with cancellation support.

Public method SearchWithAggregations(Query, int, params AggregationRequest[])

Executes a search query and computes numeric aggregations over matching documents.

Public method SearchWithCollapse(Query, int, CollapseField)

Executes a search and collapses results so only the best document per unique field value is returned. Uses SortedDocValues for the collapse field.

Public method SearchWithFacets(Query, int, params string[])

Executes a query and returns both top-N results and facet counts for the specified fields.

Public method Suggest(string, string, int)

Returns the top-N terms with the given prefix for auto-complete / suggest, ranked by global document frequency descending.