
IndexSearcher
- Namespace
- Rowles.LeanCorpus.Search.Searcher
- Assembly
- Rowles.LeanCorpus.dll
Holds a snapshot of segment readers and executes queries across all segments.
public sealed class IndexSearcher : IDisposable
IndexSearcher(MMapDirectory, ISimilarity?)
Initialises a new IndexSearcher by loading the latest committed segments from the given directory.
IndexSearcher(MMapDirectory, IndexSearcherConfig)
Initialises a new IndexSearcher by loading the latest committed segments from the given directory.
IndexSearcher(MMapDirectory, IReadOnlyList<SegmentInfo>, ISimilarity?)
Initialises a new IndexSearcher over the given pre-built segment list (NRT or snapshot scenario).
IndexSearcher(MMapDirectory, IReadOnlyList<SegmentInfo>, IndexSearcherConfig)
Initialises a new IndexSearcher over the given pre-built segment list with the specified configuration.
t_collectorHeapCache
t_docFreqTermsBuf
t_fallbackCandidateIds
t_fallbackInCandidate
t_fallbackInClause
t_fallbackInUse
t_fallbackScores
t_patternDocIds
t_patternScores
t_patternSeen
t_postingsBuffer
Cache
The query result cache, or null if caching is disabled.
Metrics
The metrics collector for this searcher.
Stats
Corpus-wide statistics computed at construction.
Dispose()
Disposes all underlying segment readers.

ExecuteMoreLikeThis(MoreLikeThisQuery, int)
Explain(TermQuery, int)
Explains the score computation for a specific document and query. Returns null if the document does not match the query.
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.
GetIndexSize()
Calculates the on-disk size of the index.
GetStoredFields(int)
Retrieves stored fields for a global document ID.
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.
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.
Search(Query, int, SortField)
Searches with a custom sort order instead of relevance ranking. Matching documents are collected, then a heap-select picks the top-N by the requested field without performing a full sort over every match.
Search(Query, int, SearchOptions)
Executes a query under the supplied SearchOptions. The top-N heap must fit within the configured result-byte budget. The deadline and cancellation token are checked at segment boundaries; on early termination the returned TopDocs has IsPartial set to true.
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.
Search(string, string, int, IAnalyser?)
Parses a query string, applies analysis, and searches.
Search(string, string, int, IAnalyser?, CancellationToken)
Parses a query string and searches with cancellation support.
SearchStreaming(Query, int, SearchOptions?)
Executes a query and yields matches in segment order, segment by segment. Honours Timeout, MaxResultBytes, and CancellationToken between segments. Results are not globally sorted by score: the caller receives each segment's local top-N, in segment order, with global doc IDs.
SearchWithAggregations(Query, int, params AggregationRequest[])
Executes a search query and computes numeric aggregations over matching documents.
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.
SearchWithFacets(Query, int, params string[])
Executes a query and returns both top-N results and facet counts for the specified fields.
Suggest(string, string, int)
Returns the top-N terms with the given prefix for auto-complete / suggest, ranked by global document frequency descending.