SearchOptions
class SearchOptions implements JsonSerializable (View source)
Methods
Specify data which should be serialized to JSON
Sets the server side timeout in milliseconds
Add a limit to the query on the number of hits it can return
Set the number of hits to skip (eg. for pagination).
Activates the explanation of each result hit in the response
If set to true, the server will not perform any scoring on the hits
Sets the consistency to consider for this FTS query to AT_PLUS and uses the MutationState to parameterize the consistency.
Configures the list of fields for which the whole value should be included in the response.
Adds one SearchFacet-s to the query
Configures the list of fields (including special fields) which are used for sorting purposes.
Configures the highlighting of matches in the response
Configures the list of collections to use for restricting results.
Details
mixed
jsonSerialize()
Specify data which should be serialized to JSON
SearchOptions
timeout(int $ms)
Sets the server side timeout in milliseconds
SearchOptions
limit(int $limit)
Add a limit to the query on the number of hits it can return
SearchOptions
skip(int $skip)
Set the number of hits to skip (eg. for pagination).
SearchOptions
explain(bool $explain)
Activates the explanation of each result hit in the response
SearchOptions
disableScoring(bool $disabled)
If set to true, the server will not perform any scoring on the hits
SearchOptions
consistentWith(string $index, MutationState $state)
Sets the consistency to consider for this FTS query to AT_PLUS and uses the MutationState to parameterize the consistency.
This replaces any consistency tuning previously set.
SearchOptions
fields(array $fields)
Configures the list of fields for which the whole value should be included in the response.
If empty, no field values are included. This drives the inclusion of the fields in each hit. Note that to be highlighted, the fields must be stored in the FTS index.
SearchOptions
facets(array $facets)
Adds one SearchFacet-s to the query
This is an additive operation (the given facets are added to any facet previously requested), but if an existing facet has the same name it will be replaced.
Note that to be faceted, a field's value must be stored in the FTS index.
SearchOptions
sort(array $specs)
Configures the list of fields (including special fields) which are used for sorting purposes.
If empty, the default sorting (descending by score) is used by the server.
The list of sort fields can include actual fields (like "firstname" but then they must be stored in the index, configured in the server side mapping). Fields provided first are considered first and in a "tie" case the next sort field is considered. So sorting by "firstname" and then "lastname" will first sort ascending by the firstname and if the names are equal then sort ascending by lastname. Special fields like "_id" and "_score" can also be used. If prefixed with "-" the sort order is set to descending.
If no sort is provided, it is equal to sort("-_score"), since the server will sort it by score in descending order.
SearchOptions
highlight(string $style = null, array $fields = null)
Configures the highlighting of matches in the response
SearchOptions
collections(array $collectionNames)
Configures the list of collections to use for restricting results.