$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); } $s = ''; foreach ($db->allterms_begin() as $k => $term) { $s .= "({$term}:{$k->get_termfreq()})"; } if ($s !== '(coffee:1)') { print "PHP Iterator iteration of allterms doesn't work ({$s})\n"; exit(1); } # Test reference tracking and regression test for #659. $qp = new XapianQueryParser(); $stop = new XapianSimpleStopper(); $stop->add('a'); $qp->set_stopper($stop); $query = $qp->parse_query('a b'); if ($query->get_description() !== 'Query(b@2)') { print "XapianQueryParser::set_stopper() didn't work as expected - result was " . $query->get_description() . "\n"; exit(1); }