コード例 #1
0
try {
    $query = $qp->parse_query('spam:spam');
    print "testfieldprocessor exception not rethrown\n";
    exit(1);
} catch (Exception $e) {
    if ($e->getMessage() !== 'already spam') {
        print "Exception has wrong message\n";
        exit(1);
    }
}
# Test setting and getting metadata
if ($db->get_metadata('Foo') !== '') {
    print "Unexpected value for metadata associated with 'Foo' (expected ''): '" . $db->get_metadata('Foo') . "'\n";
    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() != "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);