The input text is analyzed and a phrase query is built with the terms resulting from the analysis. More...
#include <couchbase/match_phrase_query.hxx>
Public Member Functions | |
match_phrase_query (std::string match_phrase) | |
Create a new match phrase query. | |
auto | analyzer (std::string analyzer_name) -> match_phrase_query & |
Analyzers are used to transform input text into a stream of tokens for indexing. | |
auto | field (std::string field_name) -> match_phrase_query & |
If a field is specified, only terms in that field will be matched. | |
auto | encode () const -> encoded_search_query override |
![]() | |
virtual | ~search_query ()=default |
template<typename derived_query = search_query, std::enable_if_t< std::is_base_of_v< search_query, derived_query >, bool > = true> | |
auto | boost (double boost) -> derived_query & |
The boost parameter is used to increase the relative weight of a clause (with a boost greater than 1) or decrease the relative weight (with a boost between 0 and 1). | |
Additional Inherited Members | |
![]() | |
search_query ()=default | |
![]() | |
std::optional< double > | boost_ {} |
The input text is analyzed and a phrase query is built with the terms resulting from the analysis.
This type of query searches for terms occurring in the specified positions and offsets. This depends on term vectors, which are consulted to determine phrase distance.
For example, a match phrase query for "location for functions"
is matched with "locate the
function"
, if the standard analyzer is used: this analyzer uses a stemmer, which tokenizes "location"
and "locate"
to "locat"
, and reduces "functions"
and "function"
to "function"
. Additionally, the analyzer employs stop removal, which removes small and less significant words from input and target text, so that matches are attempted on only the more significant elements of vocabulary: in this case "for"
and "the"
are removed. Following this processing, the tokens "locat"
and "function"
are recognized as common to both input and target; and also as being both in the same sequence as, and at the same distance from one another; and therefore a match is made.
|
inlineexplicit |
Create a new match phrase query.
match_phrase | the input string to be matched against |
|
inline |
Analyzers are used to transform input text into a stream of tokens for indexing.
The Server comes with built-in analyzers and the users can create their own.
analyzer_name | the name of the analyzer used |
|
nodiscardoverridevirtual |
Implements search_query.
|
inline |
If a field is specified, only terms in that field will be matched.
This can also affect the used analyzer if one isn't specified explicitly.
field_name | name of the field to be matched |