Query and sorting options

When you call the Index.Search method using a query string alone, the results are returned according to the default query options:

  • Documents are returned sorted in order of descending rank
  • Documents are returned in groups of 20 at a time
  • Retrieved documents contain all of their original fields

You can use an instance of the SearchOptions struct as the argument to `Search` to change these options.

The SearchOptions struct allows you to specify how many documents to return at a time. It also lets you customize the contents of the retrieved documents. You can ask for document identifiers only, or request that documents contain only a subset of their fields. You can also create custom fields in the retrieved documents by using field expressions (fields with values derived from other fields in the document).

Apart from the query options, the `SearchOptions` struct can also include an instance of the SortOptions struct. Using sort options you can change the sort order, and sort the results on multiple keys.

SearchOptions

These properties control how many results are returned and in what order. The offset and cursor options, which are mutually exclusive, support pagination. They specify which selected documents to return in the results.

Property Description Default Maximum
Limit The maximum number of documents to return in the results. 20 1000