Constants

HIGHLIGHT_HTML

HIGHLIGHT_HTML

HIGHLIGHT_ANSI

HIGHLIGHT_ANSI

HIGHLIGHT_SIMPLE

HIGHLIGHT_SIMPLE

Methods

booleanField()

booleanField(boolean  $value) : \Couchbase\BooleanFieldSearchQuery

Prepare boolean field search query

Parameters

boolean $value

Returns

\Couchbase\BooleanFieldSearchQuery

docId()

docId(string  $documentIds) : \Couchbase\DocIdSearchQuery

Prepare document ID search query

Parameters

string $documentIds

Returns

\Couchbase\DocIdSearchQuery

match()

match(string  $match) : \Couchbase\MatchSearchQuery

Prepare match search query

Parameters

string $match

Returns

\Couchbase\MatchSearchQuery

matchPhrase()

matchPhrase(string  $terms) : \Couchbase\MatchPhraseSearchQuery

Prepare phrase search query

Parameters

string $terms

Returns

\Couchbase\MatchPhraseSearchQuery

prefix()

prefix(string  $prefix) : \Couchbase\PrefixSearchQuery

Prepare prefix search query

Parameters

string $prefix

Returns

\Couchbase\PrefixSearchQuery

queryString()

queryString(string  $queryString) : \Couchbase\QueryStringSearchQuery

Prepare query string search query

Parameters

string $queryString

Returns

\Couchbase\QueryStringSearchQuery

regexp()

regexp(string  $regexp) : \Couchbase\RegexpSearchQuery

Prepare regexp search query

Parameters

string $regexp

Returns

\Couchbase\RegexpSearchQuery

term()

term(string  $term) : \Couchbase\TermSearchQuery

Prepare term search query

Parameters

string $term

Returns

\Couchbase\TermSearchQuery

wildcard()

wildcard(string  $wildcard) : \Couchbase\WildcardSearchQuery

Prepare wildcard search query

Parameters

string $wildcard

Returns

\Couchbase\WildcardSearchQuery

geoDistance()

geoDistance(float  $longitude, float  $latitude, string  $distance) : \Couchbase\GeoDistanceSearchQuery

Prepare geo distance search query

Parameters

float $longitude
float $latitude
string $distance

e.g. "10mi"

Returns

\Couchbase\GeoDistanceSearchQuery

geoBoundingBox()

geoBoundingBox(float  $topLeftLongitude, float  $topLeftLatitude, float  $bottomRightLongitude, float  $bottomRightLatitude) : \Couchbase\GeoBoundingBoxSearchQuery

Prepare geo bounding box search query

Parameters

float $topLeftLongitude
float $topLeftLatitude
float $bottomRightLongitude
float $bottomRightLatitude

Returns

\Couchbase\GeoBoundingBoxSearchQuery

termFacet()

termFacet(string  $field, integer  $limit) : \Couchbase\TermSearchFacet

Prepare term search facet

Parameters

string $field
integer $limit

Returns

\Couchbase\TermSearchFacet

dateRangeFacet()

dateRangeFacet(string  $field, integer  $limit) : \Couchbase\DateRangeSearchFacet

Prepare date range search facet

Parameters

string $field
integer $limit

Returns

\Couchbase\DateRangeSearchFacet

numericRangeFacet()

numericRangeFacet(string  $field, integer  $limit) : \Couchbase\NumericRangeSearchFacet

Prepare numeric range search facet

Parameters

string $field
integer $limit

Returns

\Couchbase\NumericRangeSearchFacet

__construct()

__construct(string  $indexName, \Couchbase\SearchQueryPart  $queryPart) 

Prepare an FTS SearchQuery on an index.

Top level query parameters can be set after that by using the fluent API.

Parameters

string $indexName

the FTS index to search in

\Couchbase\SearchQueryPart $queryPart

the body of the FTS query (e.g. a match phrase query)

limit()

limit(integer  $limit) : \Couchbase\SearchQuery

Add a limit to the query on the number of hits it can return

Parameters

integer $limit

the maximum number of hits to return

Returns

\Couchbase\SearchQuery

skip()

skip(integer  $skip) : \Couchbase\SearchQuery

Set the number of hits to skip (eg. for pagination).

Parameters

integer $skip

the number of results to skip

Returns

\Couchbase\SearchQuery

explain()

explain(boolean  $explain) : \Couchbase\SearchQuery

Activates the explanation of each result hit in the response

Parameters

boolean $explain

Returns

\Couchbase\SearchQuery

serverSideTimeout()

serverSideTimeout(integer  $serverSideTimeout) : \Couchbase\SearchQuery

Sets the server side timeout in milliseconds

Parameters

integer $serverSideTimeout

the server side timeout to apply

Returns

\Couchbase\SearchQuery

consistentWith()

consistentWith(\Couchbase\MutationState  $state) : \Couchbase\SearchQuery

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.

Parameters

\Couchbase\MutationState $state

the mutation state information to work with

Returns

\Couchbase\SearchQuery

fields()

fields(string  $fields) : \Couchbase\SearchQuery

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.

Parameters

string $fields

Returns

\Couchbase\SearchQuery

highlight()

highlight(string  $style, string  $fields) : \Couchbase\SearchQuery

Configures the highlighting of matches in the response

Parameters

string $style

highlight style to apply. Use constants HIGHLIGHT_HTML, HIGHLIGHT_ANSI, HIGHLIGHT_SIMPLE.

string $fields

the optional fields on which to highlight. If none, all fields where there is a match are highlighted.

Returns

\Couchbase\SearchQuery

sort()

sort(  $sort) : \Couchbase\SearchQuery

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.

Parameters

$sort

Returns

\Couchbase\SearchQuery

addFacet()

addFacet(string  $name, \Couchbase\SearchFacet  $facet) : \Couchbase\SearchQuery

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.

Parameters

string $name
\Couchbase\SearchFacet $facet

Returns

\Couchbase\SearchQuery