Couchbase C++ SDK 1.0.1 (rev. 58d46d7)
Loading...
Searching...
No Matches
numeric_range_query Class Reference

The numeric range query finds documents containing a numeric value in the specified field within the specified range. More...

#include <couchbase/numeric_range_query.hxx>

Inheritance diagram for numeric_range_query:
Inheritance graph

Public Member Functions

auto min (double value) -> numeric_range_query &
 Set lower limit of the range.
 
auto min (double value, bool inclusive) -> numeric_range_query &
 Set lower limit and specify whether to include it into the limit.
 
auto max (double value) -> numeric_range_query &
 Set upper limit of the range.
 
auto max (double value, bool inclusive) -> numeric_range_query &
 Set upper limit and specify whether to include it into the limit.
 
auto field (std::string field_name) -> numeric_range_query &
 If a field is specified, only terms in that field will be matched.
 
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 numeric range query finds documents containing a numeric value in the specified field within the specified range.

Either min or max can be omitted, but not both.

By default, min is inclusive and max is exclusive.

Match documents where field id contains numbers in the range (100, 1000):

.field("id")
.min(100, /* inclusive= */ false)
.max(1000, /* inclusive= */ false);
Since
1.0.0
Committed
Generally available API and should be preferred in production

Member Function Documentation

◆ encode()

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

Implements search_query.

◆ field()

auto field ( std::string field_name) -> numeric_range_query&
inline

If a field is specified, only terms in that field will be matched.

Parameters
field_namename of the field to be matched
Returns
this query for chaining purposes.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ max() [1/2]

auto max ( double value) -> numeric_range_query&
inline

Set upper limit of the range.

Whether to include limit into the range will be decided by server defaults (exclusive).

Parameters
valueupper limit of the range
Returns
this query for chaining purposes.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ max() [2/2]

auto max ( double value,
bool inclusive ) -> numeric_range_query&
inline

Set upper limit and specify whether to include it into the limit.

Parameters
valueupper limit of the range.
inclusivewhether to include limit value into the interval.
Returns
this query for chaining purposes.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ min() [1/2]

auto min ( double value) -> numeric_range_query&
inline

Set lower limit of the range.

Whether to include limit into the range will be decided by server defaults (inclusive).

Parameters
valuelower limit of the range.
Returns
this query for chaining purposes.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ min() [2/2]

auto min ( double value,
bool inclusive ) -> numeric_range_query&
inline

Set lower limit and specify whether to include it into the limit.

Parameters
valuelower limit of the range.
inclusivewhether to include limit value into the interval.
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: