Class SearchOptions
- Namespace
- TantivyDotNet
- Assembly
- TantivyDotNet.dll
Everything about a search besides the query: paging, ordering, returned fields, snippets, facet counts and aggregations. Pass it to Search(Query, SearchOptions).
public sealed class SearchOptions
- Inheritance
-
SearchOptions
- Inherited Members
Examples
var results = searcher.Search(query, new SearchOptions
{
Limit = 20,
Offset = 40,
OrderBy = [SortBy.Field("year", descending: true)],
Snippets = new SnippetOptions("body"),
Facets = [new FacetRequest("genre")],
});
Properties
- Aggregations
Aggregations to compute over all matching documents, as a JSON object in Tantivy's Elasticsearch-compatible format, or null for none. Results are in Aggregations. Aggregated fields must be fast fields.
- Facets
Facet categories to count over all matching documents (not just the returned page), or null for none. Results are in Facets.
- Fields
The stored fields to return in each hit's Document, or null (the default) for all of them. Fewer fields means less to decode and copy per hit; an empty list returns no fields and skips the document store entirely (unless Snippets are requested).
- Limit
Maximum number of hits to return. 0 returns no hits but still computes TotalCount and facets. Default 10.
- Offset
Number of top hits to skip, for paging. Default 0.
- OrderBy
How to order hits: one or more keys, each breaking ties of the previous ones, for example
[SortBy.Field("year", descending: true), SortBy.Score()]. Null or empty (the default) orders by relevance, best first. Remaining ties keep index order.
- SearchAfter
Returns only hits that come after the hit whose Cursor this is, for deep paging: unlike Offset, the cost doesn't grow with the page number. Null (the default) starts from the first hit.