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

This query finds all matches from a given location as geo_point within the given distance. More...

#include <couchbase/geo_distance_query.hxx>

Inheritance diagram for geo_distance_query:
Inheritance graph

Public Member Functions

 geo_distance_query (geo_point location, std::string distance)
 Create a new geo distance query.
 
 geo_distance_query (double latitude, double longitude, std::string distance)
 Create a new geo distance query.
 
auto field (std::string field_name) -> geo_distance_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

This query finds all matches from a given location as geo_point within the given distance.

Both the point and the distance are required.

The following query specifies a longitude of -2.235143 and a latitude of 53.482358. The target-field geo is specified, as is a distance of 100 miles: this is the radius within which target-locations must reside for their documents to be returned.

auto query = couchbase::geo_distance_query(53.482358, -2.235143, "100mi").field("geo");
See also
https://docs.couchbase.com/server/current/fts/fts-supported-queries-geo-point-distance.html server documentation
Since
1.0.0
Committed
Generally available API and should be preferred in production

Constructor & Destructor Documentation

◆ geo_distance_query() [1/2]

geo_distance_query ( geo_point location,
std::string distance )
inline

Create a new geo distance query.

Parameters
locationthe location represents a point from which the distance is measured.
distancethe distance describes how far from the location the radius should be matched. For example, "11km", "11kilometers", "3nm", "3nauticalmiles", "17mi", "17miles", "19m", "19meters".
See also
https://github.com/blevesearch/bleve/blob/ae28975038cb25655da968e3f043210749ba382b/geo/geo_dist.go#L29-L37 list of distance units.
Since
1.0.0
Committed
Generally available API and should be preferred in production

◆ geo_distance_query() [2/2]

geo_distance_query ( double latitude,
double longitude,
std::string distance )
inline

Create a new geo distance query.

Parameters
latitudethe location latitude
longitudethe location longitude
distancethe distance describes how far from the location the radius should be matched. For example, "11km", "11kilometers", "3nm", "3nauticalmiles", "17mi", "17miles", "19m", "19meters".
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.

◆ field()

auto field ( std::string field_name) -> geo_distance_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

The documentation for this class was generated from the following file: