print "PHP Iterator wrapping of TermIterator keys doesn't work ({$s})\n"; exit(1); } # Test GeoSpatial API $coord = new XapianLatLongCoord(); $coord = new XapianLatLongCoord(-41.288889, 174.777222); define('COORD_SLOT', 2); $metric = new XapianGreatCircleMetric(); $range = 42.0; $centre = new XapianLatLongCoords($coord); $query = new XapianQuery(new XapianLatLongDistancePostingSource(COORD_SLOT, $centre, $metric, $range)); $db = Xapian::inmemory_open(); $coords = new XapianLatLongCoords(); $coords->append(new XapianLatLongCoord(40.6048, -74.4427)); $doc = new XapianDocument(); $doc->add_term("coffee"); $doc->add_value(COORD_SLOT, $coords->serialise()); $db->add_document($doc); $centre = new XapianLatLongCoords(); $centre->append(new XapianLatLongCoord(40.6048, -74.4427)); $ps = new XapianLatLongDistancePostingSource(COORD_SLOT, $centre, $metric, $range); $q = new XapianQuery("coffee"); $q = new XapianQuery(XapianQuery::OP_AND, $q, new XapianQuery($ps)); $enq = new XapianEnquire($db); $enq->set_query($q); $mset = $enq->get_mset(0, 10); if ($mset->size() != 1) { print "Expected one result with XapianLatLongDistancePostingSource, got "; print $mset->size() . "\n"; exit(1); }
exit(1); } $db->set_metadata('Foo', 'Foo'); if ($db->get_metadata('Foo') !== 'Foo') { print "Unexpected value for metadata associated with 'Foo' (expected 'Foo'): '" . $db->get_metadata('Foo') . "'\n"; exit(1); } # Test OP_SCALE_WEIGHT and corresponding constructor $query4 = new XapianQuery(XapianQuery::OP_SCALE_WEIGHT, new XapianQuery('foo'), 5.0); if ($query4->get_description() != "Xapian::Query(5 * foo)") { print "Unexpected \$query4->get_description()\n"; exit(1); } # Test MultiValueKeyMaker. $doc = new XapianDocument(); $doc->add_term("foo"); $doc->add_value(0, "ABB"); $db2->add_document($doc); $doc->add_value(0, "ABC"); $db2->add_document($doc); $doc->add_value(0, "ABC"); $db2->add_document($doc); $doc->add_value(0, "ABCD"); $db2->add_document($doc); $doc->add_value(0, "ABCÿ"); $db2->add_document($doc); $enquire = new XapianEnquire($db2); $enquire->set_query(new XapianQuery("foo")); $sorter = new XapianMultiValueKeyMaker(); $sorter->add_value(0); $enquire->set_sort_by_key($sorter, true);