68 double coorddist = metric(coord1, coord2);
278 TEST((c1 < c2) ^ (c2 < c1));
280 TEST(!(c2 < c3) && !(c3 < c2));
284 TEST((c3 < c4) ^ (c4 < c3));
290 TEST(!(c1 < c4 || c4 < c1));
291 const char * ptr = s1.data();
292 const char * end = ptr + s1.size();
334 TEST_EQUAL(g2.get_description(),
"Xapian::LatLongCoords()");
335 TEST(g2.begin() == g2.end());
343 double d1 = m1(c1, c2);
350 double d2 = m2(c1, c2);
361 double d3 = (*m3)(c1, c2);
383 double d1 = m1(c1, c2);
384 double dl1 = m1(cl1, cl2);
386 double d1_str = m1(cl1, c2_str);
410 std::string k1 = keymaker(doc1);
411 std::string k2 = keymaker(doc2);
412 std::string k3 = keymaker(doc3);
413 std::string k4 = keymaker(doc4);
419 std::string k3b = keymaker2(doc3);
420 std::string k4b = keymaker2(doc4);
The Xapian namespace contains public interfaces for the Xapian library.
Xapian::docid add_document(const Xapian::Document &document)
Add a new document to the database.
void add_value(Xapian::valueno slot, const std::string &value)
Add a new value.
static void builddb_coords1(Xapian::WritableDatabase &db, const string &)
#define TEST(a)
Test a condition, without an additional explanation for failure.
This class is used to access a database, or a group of databases.
bool empty() const
Return true if and only if there are no coordinates in the container.
Xapian::docid get_docid() const
Return the current docid.
std::string get_description() const
Return a string describing this object.
std::string serialise() const
Serialise object parameters into a string.
bool at_end() const
Return true if the current position is past the last entry in this list.
a generic test suite engine
std::string serialise() const
Return a serialised representation of the coordinate.
std::string serialise() const
Return a serialised form of the coordinate list.
std::string name() const
Return the full name of the metric.
test functionality of the Xapian API
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
#define TEST_NOT_EQUAL(a, b)
Test for non-equality of two things.
Posting source which returns a weight based on geospatial distance.
LatLongCoordsIterator begin() const
Get a begin iterator for the coordinates.
A latitude-longitude coordinate.
This class provides read/write access to a database.
void unserialise(const std::string &serialised)
Unserialise a string and set this object to its coordinate.
Registry for user subclasses.
Public interfaces for the Xapian library.
double latitude
A latitude, as decimal degrees.
virtual LatLongMetric * unserialise(const std::string &serialised) const =0
Create object given string serialisation returned by serialise().
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
Base class for calculating distances between two lat/long coordinates.
A sequence of latitude-longitude coordinates.
#define TEST_EQUAL_DOUBLE(a, b)
Test two doubles for near equality.
KeyMaker subclass which sorts by distance from a latitude/longitude.
double get_weight() const
Return the weight contribution for the current document.
Xapian::Database get_database(const string &dbname)
void append(const LatLongCoord &coord)
Append a coordinate to the end of the sequence.
An iterator across the values in a LatLongCoords object.
std::string get_description() const
Return a string describing this object.
Xapian-specific test helper functions and macros.
LatLongCoordsIterator end() const
Get an end iterator for the coordinates.
Calculate the great-circle distance between two coordinates on a sphere.
DEFINE_TESTCASE(latlongpostingsource1, backend &&!remote &&!inmemory)
Test behaviour of the LatLongDistancePostingSource.
#define TEST_EQUAL(a, b)
Test for equality of two things.
void next(double min_wt)
Advance the current position to the next matching document.
A handle representing a document in a Xapian database.
size_t size() const
Get the number of coordinates in the container.
double longitude
A longitude, as decimal degrees.
const Xapian::LatLongMetric * get_lat_long_metric(const std::string &name) const
Get a lat-long metric given a name.