Couchbase C++ SDK 1.0.2 (rev. 51f4775)
Loading...
Searching...
No Matches
disjunction_query Class Reference

The disjunction query is a compound query. More...

#include <couchbase/disjunction_query.hxx>

Inheritance diagram for disjunction_query:
Inheritance graph

Public Member Functions

template<typename... SearchQuery>
 disjunction_query (SearchQuery &&... queries)
 Create a disjunction query.
 
template<typename... SearchQuery>
auto or_else (SearchQuery... queries) -> disjunction_query &
 Add one or more queries to add to the disjunction.
 
auto min (std::uint32_t number_of_queries) -> disjunction_query &
 Set the minimum number of child queries that must be satisfied for the disjunction query.
 
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_ {}
 

Detailed Description

The disjunction query is a compound query.

The result documents must satisfy a configurable minimal (min) number of child queries. By default this min is set to 1.

At execution, a conjunction query that has no child queries is not allowed and will fail fast.

Match documents with at least one (see min) of the following conditions is satisfied:

  • "location" in the field reviews.content
  • true in the field free_breakfast.
auto query =
couchbase::match_query("location hostel").field("reviews.content"),
couchbase::boolean_field_query(true).field("free_breakfast"),
couchbase::boolean_field_query(true).field("late_check_in"),
}
.min(2);
See also
https://docs.couchbase.com/server/current/fts/fts-supported-queries-conjuncts-disjuncts.html server documentation
Since
1.0.0
Committed
Generally available API and should be preferred in production

Constructor & Destructor Documentation

◆ disjunction_query()

template<typename... SearchQuery>
disjunction_query ( SearchQuery &&... queries)
inlineexplicit

Create a disjunction query.

Template Parameters
SearchQueryany subclass of search_query
Parameters
queriessequence of query arguments
Since
1.0.0
Committed
Generally available API and should be preferred in production

Member Function Documentation

◆ encode()

auto encode ( ) const -> encoded_search_query
nodiscardoverridevirtual
Returns
encoded representation of the query.
Since
1.0.0
Internal
Internal interface

Implements search_query.

◆ min()

auto min ( std::uint32_t number_of_queries) -> disjunction_query&
inline

Set the minimum number of child queries that must be satisfied for the disjunction query.

Parameters
number_of_queriesminimum number of child queries.
Returns
this query for chaining purposes.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ or_else()

template<typename... SearchQuery>
auto or_else ( SearchQuery... queries) -> disjunction_query&
inline

Add one or more queries to add to the disjunction.

Template Parameters
SearchQueryany subclass of search_query
Parameters
queriessequence of query arguments
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: