Couchbase C++ SDK 1.0.1 (rev. 58d46d7)
|
The boolean query is a useful combination of conjunction and disjunction queries. More...
#include <couchbase/boolean_query.hxx>
Public Member Functions | |
auto | must (conjunction_query query) -> boolean_query & |
Set conjunction_query that groups all queries the documents must satisfy. | |
template<typename... SearchQuery> | |
auto | must (SearchQuery... queries) -> boolean_query & |
Create conjunction_query with given queries and set it as must query. | |
auto | must () -> conjunction_query & |
Returns conjunction_query that groups all queries the documents must satisfy. | |
auto | should (disjunction_query query) -> boolean_query & |
Set disjunction_query that groups queries the documents should satisfy. | |
template<typename... SearchQuery> | |
auto | should (SearchQuery... queries) -> boolean_query & |
Create disjunction_query with given queries and set it as should query. | |
auto | should () -> disjunction_query & |
Returns disjunction_query that groups queries the documents should satisfy. | |
auto | must_not (disjunction_query query) -> boolean_query & |
Set disjunction_query that groups queries the documents must not satisfy. | |
template<typename... SearchQuery> | |
auto | must_not (SearchQuery... queries) -> boolean_query & |
Create disjunction_query with given queries and set it as must not query. | |
auto | must_not () -> disjunction_query & |
Returns disjunction_query that groups queries the documents should satisfy. | |
auto | encode () const -> encoded_search_query override |
Public Member Functions inherited from search_query | |
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 | |
Protected Member Functions inherited from search_query | |
search_query ()=default | |
Protected Attributes inherited from search_query | |
std::optional< double > | boost_ {} |
The boolean query is a useful combination of conjunction and disjunction queries.
A boolean query takes three lists of queries:
At execution, a boolean query that has no child queries in any 3 categories is not allowed and will fail fast.
The inner representation of child queries in the must
/must_not
/should
sections are respectively a conjunction_query and two disjunction_query.
In the example below the following rules enforced by the boolean query:
"hostel room"
in their reviews.content
field AND have true
in free_breakfast
field.reviews.ratings.Overall > 4
OR reviews.ratings.Service <blockquote>‍5
. * and finally, exclude documents with city
"Padfield"
or "Gilingham"
.
|
overridevirtual |
Implements search_query.
|
inline |
Returns conjunction_query that groups all queries the documents must satisfy.
Use it to add more queries.
|
inline |
Set conjunction_query that groups all queries the documents must satisfy.
query | must-query |
|
inline |
Create conjunction_query with given queries and set it as must query.
SearchQuery | any subclass of search_query |
queries |
|
inline |
Returns disjunction_query that groups queries the documents should satisfy.
Use it to add more queries.
|
inline |
Set disjunction_query that groups queries the documents must not satisfy.
query | must_not-query |
|
inline |
Create disjunction_query with given queries and set it as must not query.
SearchQuery | any subclass of search_query |
queries |
|
inline |
Returns disjunction_query that groups queries the documents should satisfy.
Use it to add more queries or change disjunction_query::min.
|
inline |
Set disjunction_query that groups queries the documents should satisfy.
query | should-query |
|
inline |
Create disjunction_query with given queries and set it as should query.
SearchQuery | any subclass of search_query |
queries |