The boolean query is a useful combination of conjunction and disjunction queries.
More...
#include <couchbase/boolean_query.hxx>
The boolean query is a useful combination of conjunction and disjunction queries.
A boolean query takes three lists of queries:
- must - result documents must satisfy all of these queries.
- should - result documents should satisfy these queries.
- must not - result documents must not satisfy any of these 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:
- retrieved documents MUST match
"hostel room"
in their reviews.content
field AND have true
in free_breakfast
field.
- also the documents SHOULD have EITHER
reviews.ratings.Overall > 4
OR reviews.ratings.Service <blockquote>‍5
.
- and finally, exclude documents with
city
"Padfield"
or "Gilingham"
.
- See also
- https://docs.couchbase.com/server/current/fts/fts-supported-queries-boolean-field-query.html server documentation
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ encode()
auto encode |
( |
| ) |
const -> encoded_search_query |
|
nodiscardoverridevirtual |
- Returns
- encoded representation of the query.
- Since
- 1.0.0
- Internal
- Internal interface
Implements search_query.
◆ must() [1/3]
Returns conjunction_query that groups all queries the documents must satisfy.
Use it to add more queries.
- Returns
- must-query
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ must() [2/3]
Set conjunction_query that groups all queries the documents must satisfy.
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ must() [3/3]
template<typename... SearchQuery>
Create conjunction_query with given queries and set it as must query.
- Template Parameters
-
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ must_not() [1/3]
Returns disjunction_query that groups queries the documents should satisfy.
Use it to add more queries.
- Returns
- must_not-query
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ must_not() [2/3]
Set disjunction_query that groups queries the documents must not satisfy.
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ must_not() [3/3]
template<typename... SearchQuery>
Create disjunction_query with given queries and set it as must not query.
- Template Parameters
-
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ should() [1/3]
◆ should() [2/3]
Set disjunction_query that groups queries the documents should satisfy.
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
◆ should() [3/3]
template<typename... SearchQuery>
Create disjunction_query with given queries and set it as should query.
- Template Parameters
-
- Parameters
-
- Returns
- this query for chaining purposes.
- Since
- 1.0.0
- Committed
- Generally available API and should be preferred in production
The documentation for this class was generated from the following file: