if ($mset->size() != sizeof($a)) { print "MSet has " . $mset->size() . " entries, expected " . sizeof($a) . "\n"; exit(1); } for ($j = 0; $j < sizeof($a); ++$j) { # PHP4 doesn't cope with: $mset->get_hit($j)->get_docid(); $hit = $mset->get_hit($j); if ($hit->get_docid() != $a[$j]) { print "Expected MSet[{$j}] to be {$a[$j]}, got " . $hit->get_docid() . "\n"; exit(1); } } } # Feature tests for Query "term" constructor optional arguments: $query_wqf = new XapianQuery('wqf', 3); if ($query_wqf->get_description() != 'Xapian::Query(wqf:(wqf=3))') { print "Unexpected \$query_wqf->get_description():\n"; print $query_wqf->get_description() . "\n"; exit(1); } $query = new XapianQuery(XapianQuery::OP_VALUE_GE, 0, "100"); if ($query->get_description() != 'Xapian::Query(VALUE_GE 0 100)') { print "Unexpected \$query->get_description():\n"; print $query->get_description() . "\n"; exit(1); } $query = XapianQuery::MatchAll(); if ($query->get_description() != 'Xapian::Query(<alldocuments>)') { print "Unexpected \$query->get_description():\n"; print $query->get_description() . "\n"; exit(1);
if ($mset->size() != sizeof($a)) { print "MSet has " . $mset->size() . " entries, expected " . sizeof($a) . "\n"; exit(1); } for ($j = 0; $j < sizeof($a); ++$j) { # PHP4 doesn't cope with: $mset->get_hit($j)->get_docid(); $hit = $mset->get_hit($j); if ($hit->get_docid() != $a[$j]) { print "Expected MSet[{$j}] to be {$a[$j]}, got " . $hit->get_docid() . "\n"; exit(1); } } } # Feature tests for Query "term" constructor optional arguments: $query_wqf = new XapianQuery('wqf', 3); if ($query_wqf->get_description() != 'Query(wqf#3)') { print "Unexpected \$query_wqf->get_description():\n"; print $query_wqf->get_description() . "\n"; exit(1); } $query = new XapianQuery(XapianQuery::OP_VALUE_GE, 0, "100"); if ($query->get_description() != 'Query(VALUE_GE 0 100)') { print "Unexpected \$query->get_description():\n"; print $query->get_description() . "\n"; exit(1); } $query = XapianQuery::MatchAll(); if ($query->get_description() != 'Query(<alldocuments>)') { print "Unexpected \$query->get_description():\n"; print $query->get_description() . "\n"; exit(1);
$hit = $mset->get_hit($j); if ($hit->get_docid() != $a[$j]) { print "Expected MSet[{$j}] to be {$a[$j]}, got " . $hit->get_docid() . "\n"; exit(1); } } } # Feature tests for Query "term" constructor optional arguments: $query_wqf = new XapianQuery('wqf', 3); if ($query_wqf->get_description() != 'Xapian::Query(wqf:(wqf=3))') { print "Unexpected \$query_wqf->get_description():\n"; print $query_wqf->get_description() . "\n"; exit(1); } $query = new XapianQuery(XapianQuery::OP_VALUE_GE, 0, "100"); if ($query->get_description() != 'Xapian::Query(VALUE_GE 0 100)') { print "Unexpected \$query->get_description():\n"; print $query->get_description() . "\n"; exit(1); } $matchspy = new XapianValueCountMatchSpy(0); $enquire->add_matchspy($matchspy); $enquire->get_mset(0, 10); $beg = $matchspy->values_begin(); $end = $matchspy->values_end(); $values = array(); while (!$beg->equals($end)) { $values[$beg->get_term()] = $beg->get_termfreq(); $beg->next(); } $expected = array("ABB" => 1, "ABC" => 1, "ABC" => 1, "ABCD" => 1, "ABCÿ" => 1);