Class Searcher
- Namespace
- TantivyDotNet
- Assembly
- TantivyDotNet.dll
Runs queries against a point-in-time snapshot of an index. Created by CreateSearcher().
public sealed class Searcher : IDisposable
- Inheritance
-
Searcher
- Implements
- Inherited Members
Remarks
Thread-safe: one searcher can serve concurrent queries from many threads. It never sees commits made after it was created; create a new searcher to pick those up. Searchers are cheap to create, but they keep their snapshot's files alive until disposed. A SearcherManager shares one searcher and replaces it after commits.
Properties
- DocumentCount
Number of live (non-deleted) documents in this snapshot.
- Schema
The schema of the searched index.
Methods
- Count(string, IEnumerable<string>?)
Counts the documents matching
querywithout retrieving them.
- Count(Query)
Counts the documents matching
querywithout retrieving them.
- Dispose()
Releases the snapshot. Safe to call more than once. Does nothing for a searcher leased from a SearcherManager: dispose the SearcherLease instead.
- Explain(Query, SearchHit)
Explains how
queryscores the document ofhit, for debugging relevance. The hit must come from this searcher.
- GetStats()
Statistics of this searcher's snapshot: segments, document counts, and sizes on disk per segment and per field.
- Search(string, int, int, IEnumerable<string>?)
Parses
querywith Tantivy's query language and returns the best-scoring documents. Shorthand forSearch(Query.Parse(query, defaultFields), limit, offset).
- Search(string, SearchOptions)
Parses
querywith Tantivy's query language (unprefixed terms search every indexed text field) and runs it withoptions. To choose the default fields, use Search(Query, SearchOptions) with Parse(string, QueryParserOptions).
- Search(Query, int, int)
Runs a query built in code and returns the best-scoring documents.
- Search(Query, SearchOptions)
Runs a query built in code with paging, ordering, snippets and facets.