SearchQuery
class SearchQuery implements JsonSerializable (View source)
Represents full text search query
Constants
HIGHLIGHT_HTML |
|
HIGHLIGHT_ANSI |
|
HIGHLIGHT_SIMPLE |
|
Methods
Prepare boolean search query
Prepare date range search query
Prepare numeric range search query
Prepare term range search query
Prepare boolean field search query
Prepare document ID search query
Prepare match search query
Prepare match all search query
Prepare match non search query
Prepare phrase search query
Prepare prefix search query
Prepare query string search query
Prepare regexp search query
Prepare term search query
Prepare wildcard search query
Prepare geo distance search query
Prepare geo bounding box search query
Prepare term search facet
Prepare date range search facet
Prepare numeric range search facet
No description
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
Sets the server side timeout in milliseconds
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.
Configures the highlighting of matches in the response
Configures the list of fields (including special fields) which are used for sorting purposes.
Details
static BooleanSearchQuery
boolean()
Prepare boolean search query
static DateRangeSearchQuery
dateRange()
Prepare date range search query
static NumericRangeSearchQuery
numericRange()
Prepare numeric range search query
static TermRangeSearchQuery
termRange()
Prepare term range search query
static BooleanFieldSearchQuery
booleanField(bool $value)
Prepare boolean field search query
static ConjunctionSearchQuery
conjuncts(SearchQueryPart ...$queries)
Prepare compound conjunction search query
static DisjunctionSearchQuery
disjuncts(SearchQueryPart ...$queries)
Prepare compound disjunction search query
static DocIdSearchQuery
docId(string ...$documentIds)
Prepare document ID search query
static MatchSearchQuery
match(string $match)
Prepare match search query
static MatchAllSearchQuery
matchAll()
Prepare match all search query
static MatchNoneSearchQuery
matchNone()
Prepare match non search query
static MatchPhraseSearchQuery
matchPhrase(string ...$terms)
Prepare phrase search query
static PrefixSearchQuery
prefix(string $prefix)
Prepare prefix search query
static QueryStringSearchQuery
queryString(string $queryString)
Prepare query string search query
static RegexpSearchQuery
regexp(string $regexp)
Prepare regexp search query
static TermSearchQuery
term(string $term)
Prepare term search query
static WildcardSearchQuery
wildcard(string $wildcard)
Prepare wildcard search query
static GeoDistanceSearchQuery
geoDistance(float $longitude, float $latitude, string $distance)
Prepare geo distance search query
static GeoBoundingBoxSearchQuery
geoBoundingBox(float $topLeftLongitude, float $topLeftLatitude, float $bottomRightLongitude, float $bottomRightLatitude)
Prepare geo bounding box search query
static TermSearchFacet
termFacet(string $field, int $limit)
Prepare term search facet
static DateRangeSearchFacet
dateRangeFacet(string $field, int $limit)
Prepare date range search facet
static NumericRangeSearchFacet
numericRangeFacet(string $field, int $limit)
Prepare numeric range search facet
__construct(string $indexName, SearchQueryPart $queryPart)
Prepare an FTS SearchQuery on an index.
Top level query parameters can be set after that by using the fluent API.
mixed
jsonSerialize()
No description
SearchQuery
limit(int $limit)
Add a limit to the query on the number of hits it can return
SearchQuery
skip(int $skip)
Set the number of hits to skip (eg. for pagination).
SearchQuery
explain(bool $explain)
Activates the explanation of each result hit in the response
SearchQuery
serverSideTimeout(int $serverSideTimeout)
Sets the server side timeout in milliseconds
SearchQuery
consistentWith(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.
SearchQuery
fields(string ...$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.
SearchQuery
highlight(string $style, string ...$fields)
Configures the highlighting of matches in the response
SearchQuery
sort(mixed ...$sort)
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.
SearchQuery
addFacet(string $name, SearchFacet $facet)
Adds one SearchFacet 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.