xapian-core  1.4.26
Public Member Functions | Private Attributes | List of all members
Xapian::LatLongDistanceKeyMaker Class Reference

KeyMaker subclass which sorts by distance from a latitude/longitude. More...

#include <geospatial.h>

+ Inheritance diagram for Xapian::LatLongDistanceKeyMaker:
+ Collaboration diagram for Xapian::LatLongDistanceKeyMaker:

Public Member Functions

 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoords &centre_, const LatLongMetric &metric_, double defdistance)
 Construct a LatLongDistanceKeyMaker. More...
 
 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoords &centre_, const LatLongMetric &metric_)
 Construct a LatLongDistanceKeyMaker. More...
 
 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoords &centre_)
 Construct a LatLongDistanceKeyMaker. More...
 
 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoord &centre_, const LatLongMetric &metric_, double defdistance)
 Construct a LatLongDistanceKeyMaker. More...
 
 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoord &centre_, const LatLongMetric &metric_)
 Construct a LatLongDistanceKeyMaker. More...
 
 LatLongDistanceKeyMaker (Xapian::valueno slot_, const LatLongCoord &centre_)
 Construct a LatLongDistanceKeyMaker. More...
 
 ~LatLongDistanceKeyMaker ()
 
std::string operator() (const Xapian::Document &doc) const
 Build a key string for a Document. More...
 
- Public Member Functions inherited from Xapian::KeyMaker
 KeyMaker ()
 Default constructor. More...
 
virtual ~KeyMaker ()
 Virtual destructor, because we have virtual methods. More...
 
KeyMakerrelease ()
 Start reference counting this object. More...
 
const KeyMakerrelease () const
 Start reference counting this object. More...
 
- Public Member Functions inherited from Xapian::Internal::opt_intrusive_base
 opt_intrusive_base (const opt_intrusive_base &)
 
opt_intrusive_baseoperator= (const opt_intrusive_base &)
 
 opt_intrusive_base ()
 Construct object which is initially not reference counted. More...
 
virtual ~opt_intrusive_base ()
 
void ref () const
 
void unref () const
 

Private Attributes

Xapian::valueno slot
 The value slot to read. More...
 
LatLongCoords centre
 The centre point (or points) for distance calculation. More...
 
const LatLongMetricmetric
 The metric to use when calculating distances. More...
 
std::string defkey
 The default key to return, for documents with no value stored. More...
 

Additional Inherited Members

- Public Attributes inherited from Xapian::Internal::opt_intrusive_base
unsigned _refs
 Reference count. More...
 
- Protected Member Functions inherited from Xapian::Internal::opt_intrusive_base
void release () const
 Start reference counting. More...
 

Detailed Description

KeyMaker subclass which sorts by distance from a latitude/longitude.

Experimental - see https://xapian.org/docs/deprecation#experimental-features

Results are ordered by the distance from a fixed point, or list of points, calculated according to the metric supplied. If multiple points are supplied (either in the constructor, or in the coordinates stored in a document), the closest pointwise distance is used.

If a document contains no coordinate stored in the specified slot, a special value for the distance will be used. This defaults to a large number, so that such results get a low rank, but may be specified by a constructor parameter.

Definition at line 551 of file geospatial.h.

Constructor & Destructor Documentation

◆ LatLongDistanceKeyMaker() [1/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoords centre_,
const LatLongMetric metric_,
double  defdistance 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_List of points to calculate distance from (closest distance is used).
metric_LatLongMetric to use.
defdistanceDistance to use for docs with no value set.

Definition at line 574 of file geospatial.h.

◆ LatLongDistanceKeyMaker() [2/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoords centre_,
const LatLongMetric metric_ 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_List of points to calculate distance from (closest distance is used).
metric_LatLongMetric to use.

Documents where no value is set are assumed to be a large distance away.

Definition at line 594 of file geospatial.h.

◆ LatLongDistanceKeyMaker() [3/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoords centre_ 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_List of points to calculate distance from (closest distance is used).

Xapian::GreatCircleMetric is used as the metric.

Documents where no value is set are assumed to be a large distance away.

Definition at line 614 of file geospatial.h.

◆ LatLongDistanceKeyMaker() [4/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoord centre_,
const LatLongMetric metric_,
double  defdistance 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_Point to calculate distance from.
metric_LatLongMetric to use.
defdistanceDistance to use for docs with no value set.

Definition at line 629 of file geospatial.h.

References Xapian::LatLongCoords::append().

◆ LatLongDistanceKeyMaker() [5/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoord centre_,
const LatLongMetric metric_ 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_Point to calculate distance from.
metric_LatLongMetric to use.

Documents where no value is set are assumed to be a large distance away.

Definition at line 650 of file geospatial.h.

References Xapian::LatLongCoords::append().

◆ LatLongDistanceKeyMaker() [6/6]

Xapian::LatLongDistanceKeyMaker::LatLongDistanceKeyMaker ( Xapian::valueno  slot_,
const LatLongCoord centre_ 
)
inline

Construct a LatLongDistanceKeyMaker.

Parameters
slot_Value slot to use.
centre_Point to calculate distance from.

Xapian::GreatCircleMetric is used as the metric.

Documents where no value is set are assumed to be a large distance away.

Definition at line 671 of file geospatial.h.

References Xapian::LatLongCoords::append().

◆ ~LatLongDistanceKeyMaker()

LatLongDistanceKeyMaker::~LatLongDistanceKeyMaker ( )

Definition at line 46 of file latlong_distance_keymaker.cc.

Member Function Documentation

◆ operator()()

string LatLongDistanceKeyMaker::operator() ( const Xapian::Document doc) const
virtual

Build a key string for a Document.

These keys can be used for sorting or collapsing matching documents.

Parameters
docDocument object to build a key for.

Implements Xapian::KeyMaker.

Definition at line 34 of file latlong_distance_keymaker.cc.

References Xapian::Document::get_value(), Xapian::sortable_serialise(), and Xapian::LatLongCoords::unserialise().

Member Data Documentation

◆ centre

LatLongCoords Xapian::LatLongDistanceKeyMaker::centre
private

The centre point (or points) for distance calculation.

Definition at line 557 of file geospatial.h.

◆ defkey

std::string Xapian::LatLongDistanceKeyMaker::defkey
private

The default key to return, for documents with no value stored.

Definition at line 563 of file geospatial.h.

◆ metric

const LatLongMetric* Xapian::LatLongDistanceKeyMaker::metric
private

The metric to use when calculating distances.

Definition at line 560 of file geospatial.h.

◆ slot

Xapian::valueno Xapian::LatLongDistanceKeyMaker::slot
private

The value slot to read.

Definition at line 554 of file geospatial.h.


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