xapian-core
1.4.26
|
Query-related tests. More...
#include <config.h>
#include "api_query.h"
#include <xapian.h>
#include "testsuite.h"
#include "testutils.h"
#include "apitest.h"
Go to the source code of this file.
Classes | |
struct | wildcard_testcase |
struct | positional_testcase |
Macros | |
#define | WILDCARD_EXCEPTION { 0, 0, 0, "" } |
Functions | |
DEFINE_TESTCASE (queryterms1, !backend) | |
DEFINE_TESTCASE (matchall2, !backend) | |
DEFINE_TESTCASE (matchnothing1, !backend) | |
DEFINE_TESTCASE (overload1, !backend) | |
DEFINE_TESTCASE (possubqueries1, backend) | |
Regression test and feature test. More... | |
DEFINE_TESTCASE (xor3, backend) | |
Test that XOR handles all remaining subqueries running out at the same. More... | |
DEFINE_TESTCASE (nonutf8termdesc1, !backend) | |
Check encoding of non-UTF8 terms in query descriptions. More... | |
DEFINE_TESTCASE (queryintro1, !backend) | |
Test introspection on Query objects. More... | |
DEFINE_TESTCASE (phrasealldocs1, backend) | |
Regression test for bug introduced in 1.3.1 and fixed in 1.3.3. More... | |
DEFINE_TESTCASE (wildcard1, backend) | |
DEFINE_TESTCASE (wildcard2, backend) | |
Regression test for #696, fixed in 1.3.4. More... | |
DEFINE_TESTCASE (wildcard4, backend) | |
Regression test for OP_WILDCARD bug, fixed in 1.4.26. More... | |
DEFINE_TESTCASE (dualprefixwildcard1, backend) | |
DEFINE_TESTCASE (loosephrase1, backend) | |
Regression test for bug fixed in 1.3.3 and 1.2.21. More... | |
DEFINE_TESTCASE (loosenear1, backend) | |
Regression tests for bugs fixed in 1.3.3 and 1.2.21. More... | |
DEFINE_TESTCASE (complexphrase1, backend) | |
Regression test for bug fixed in 1.3.6 - the first case segfaulted in 1.3.x. More... | |
DEFINE_TESTCASE (complexnear1, backend) | |
Regression test for bug fixed in 1.3.6 - the first case segfaulted in 1.3.x. More... | |
DEFINE_TESTCASE (complexphrase2, backend) | |
Check subqueries of MatchAll, MatchNothing and PostingSource are supported. More... | |
DEFINE_TESTCASE (complexnear2, backend) | |
Check subqueries of MatchAll, MatchNothing and PostingSource are supported. More... | |
DEFINE_TESTCASE (zeroestimate1, backend) | |
A zero estimated number of matches broke the code to round the estimate. More... | |
DEFINE_TESTCASE (complexphrase3, backend) | |
Feature test for OR under OP_PHRASE support added in 1.4.3. More... | |
DEFINE_TESTCASE (complexnear3, backend) | |
Feature test for OR under OP_NEAR support added in 1.4.3. More... | |
static void | gen_subdbwithoutpos1_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (subdbwithoutpos1, backend) | |
DEFINE_TESTCASE (notandor1, backend) | |
DEFINE_TESTCASE (boolorbug1, backend) | |
DEFINE_TESTCASE (hoistnotbug1, backend) | |
DEFINE_TESTCASE (emptynot1, backend) | |
DEFINE_TESTCASE (emptymaybe1, backend) | |
DEFINE_TESTCASE (phraseweightcheckbug1, backend) | |
DEFINE_TESTCASE (orphanedhint1, backend) | |
Variables | |
static const wildcard_testcase | wildcard1_testcases [] |
static const positional_testcase | loosephrase1_testcases [] |
static const positional_testcase | loosenear1_testcases [] |
Query-related tests.
Definition in file api_query.cc.
#define WILDCARD_EXCEPTION { 0, 0, 0, "" } |
Definition at line 459 of file api_query.cc.
DEFINE_TESTCASE | ( | queryterms1 | , |
! | backend | ||
) |
Regression test - in 1.0.10 and earlier "" was included in the list.
Definition at line 35 of file api_query.cc.
References Xapian::Query::get_terms_begin(), Xapian::Query::get_terms_end(), Xapian::Query::get_unique_terms_begin(), Xapian::Query::get_unique_terms_end(), Xapian::Query::MatchAll, query(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | matchall2 | , |
! | backend | ||
) |
Definition at line 68 of file api_query.cc.
References Xapian::Query::MatchAll, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | matchnothing1 | , |
! | backend | ||
) |
Definition at line 73 of file api_query.cc.
References Xapian::Query::MatchNothing, Xapian::Query::OP_AND, Xapian::Query::OP_AND_MAYBE, Xapian::Query::OP_AND_NOT, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | overload1 | , |
! | backend | ||
) |
Definition at line 107 of file api_query.cc.
References Xapian::Query::get_description(), Xapian::Query::MatchNothing, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | possubqueries1 | , |
backend | |||
) |
Regression test and feature test.
This threw AssertionError in 1.0.9 and earlier (bug#201) and gave valgrind errors in 1.0.11 and earlier (bug#349).
Currently the OR-subquery case is supported, other operators aren't.
Definition at line 268 of file api_query.cc.
References Xapian::WritableDatabase::add_document(), Xapian::Document::add_posting(), get_database(), Xapian::Query::get_description(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND, Xapian::Query::OP_NEAR, Xapian::Query::OP_OR, Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), TEST_EXCEPTION, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | xor3 | , |
backend | |||
) |
Test that XOR handles all remaining subqueries running out at the same.
Definition at line 340 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_XOR, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | nonutf8termdesc1 | , |
! | backend | ||
) |
Check encoding of non-UTF8 terms in query descriptions.
Definition at line 370 of file api_query.cc.
References TEST_EQUAL.
DEFINE_TESTCASE | ( | queryintro1 | , |
! | backend | ||
) |
Test introspection on Query objects.
Definition at line 384 of file api_query.cc.
References Xapian::Query::get_num_subqueries(), Xapian::Query::get_subquery(), Xapian::Query::get_type(), Xapian::Query::LEAF_MATCH_ALL, Xapian::Query::LEAF_MATCH_NOTHING, Xapian::Query::LEAF_TERM, Xapian::Query::MatchAll, Xapian::Query::MatchNothing, Xapian::Query::OP_AND_NOT, and TEST_EQUAL.
DEFINE_TESTCASE | ( | phrasealldocs1 | , |
backend | |||
) |
Regression test for bug introduced in 1.3.1 and fixed in 1.3.3.
Definition at line 439 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND_NOT, Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | wildcard1 | , |
backend | |||
) |
Definition at line 469 of file api_query.cc.
References FAIL_TEST, get_database(), Xapian::Enquire::get_mset(), mset_range_is_same(), Xapian::Query::OP_SYNONYM, Xapian::Query::OP_WILDCARD, Xapian::Enquire::set_query(), Xapian::MSet::size(), SKIP_TEST_FOR_BACKEND, TEST, TEST_EQUAL, tout, Xapian::Query::WILDCARD_LIMIT_ERROR, Xapian::Query::WILDCARD_LIMIT_FIRST, and Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT.
DEFINE_TESTCASE | ( | wildcard2 | , |
backend | |||
) |
Regression test for #696, fixed in 1.3.4.
Definition at line 521 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Query::OP_WILDCARD, Xapian::Enquire::set_query(), Xapian::MSet::size(), SKIP_TEST_FOR_BACKEND, TEST_EQUAL, and Xapian::Query::WILDCARD_LIMIT_MOST_FREQUENT.
DEFINE_TESTCASE | ( | wildcard4 | , |
backend | |||
) |
Regression test for OP_WILDCARD bug, fixed in 1.4.26.
Fix overly high reported termweight values in some cases.
Definition at line 547 of file api_query.cc.
References get_database(), Xapian::Enquire::get_matching_terms_begin(), Xapian::Enquire::get_matching_terms_end(), Xapian::Enquire::get_mset(), Xapian::MSet::get_termweight(), Xapian::Query::OP_OR, Xapian::Query::OP_WILDCARD, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, TEST_EQUAL_DOUBLE, TEST_REL, and Xapian::Query::WILDCARD_LIMIT_ERROR.
DEFINE_TESTCASE | ( | dualprefixwildcard1 | , |
backend | |||
) |
Definition at line 577 of file api_query.cc.
References get_database(), Xapian::Query::get_description(), Xapian::Enquire::get_mset(), Xapian::Query::OP_SYNONYM, Xapian::Query::OP_WILDCARD, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and tout.
DEFINE_TESTCASE | ( | loosephrase1 | , |
backend | |||
) |
Regression test for bug fixed in 1.3.3 and 1.2.21.
Definition at line 605 of file api_query.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | loosenear1 | , |
backend | |||
) |
Regression tests for bugs fixed in 1.3.3 and 1.2.21.
Definition at line 638 of file api_query.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_NEAR, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | complexphrase1 | , |
backend | |||
) |
Regression test for bug fixed in 1.3.6 - the first case segfaulted in 1.3.x.
Definition at line 658 of file api_query.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_PHRASE, query(), Xapian::Enquire::set_query(), and TEST.
DEFINE_TESTCASE | ( | complexnear1 | , |
backend | |||
) |
Regression test for bug fixed in 1.3.6 - the first case segfaulted in 1.3.x.
Definition at line 674 of file api_query.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_NEAR, query(), Xapian::Enquire::set_query(), and TEST.
DEFINE_TESTCASE | ( | complexphrase2 | , |
backend | |||
) |
Check subqueries of MatchAll, MatchNothing and PostingSource are supported.
Definition at line 690 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::MatchAll, Xapian::Query::MatchNothing, Xapian::Query::OP_OR, Xapian::Query::OP_PHRASE, query(), and Xapian::Enquire::set_query().
DEFINE_TESTCASE | ( | complexnear2 | , |
backend | |||
) |
Check subqueries of MatchAll, MatchNothing and PostingSource are supported.
Definition at line 711 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::MatchAll, Xapian::Query::MatchNothing, Xapian::Query::OP_NEAR, Xapian::Query::OP_OR, query(), and Xapian::Enquire::set_query().
DEFINE_TESTCASE | ( | zeroestimate1 | , |
backend | |||
) |
A zero estimated number of matches broke the code to round the estimate.
Definition at line 732 of file api_query.cc.
References get_database(), Xapian::MSet::get_matches_estimated(), Xapian::Enquire::get_mset(), Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | complexphrase3 | , |
backend | |||
) |
Feature test for OR under OP_PHRASE support added in 1.4.3.
Definition at line 743 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), mset_expect_order(), Xapian::Query::OP_PHRASE, query(), and Xapian::Enquire::set_query().
DEFINE_TESTCASE | ( | complexnear3 | , |
backend | |||
) |
Feature test for OR under OP_NEAR support added in 1.4.3.
Definition at line 769 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), mset_expect_order(), Xapian::Query::OP_NEAR, query(), and Xapian::Enquire::set_query().
DEFINE_TESTCASE | ( | subdbwithoutpos1 | , |
backend | |||
) |
Definition at line 804 of file api_query.cc.
References Xapian::Database::add_database(), gen_subdbwithoutpos1_db(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and XFAIL_FOR_BACKEND().
DEFINE_TESTCASE | ( | notandor1 | , |
backend | |||
) |
Definition at line 851 of file api_query.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::MSet::get_matches_estimated(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | boolorbug1 | , |
backend | |||
) |
Definition at line 864 of file api_query.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::MSet::get_matches_estimated(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | hoistnotbug1 | , |
backend | |||
) |
Definition at line 877 of file api_query.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::MSet::get_matches_estimated(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | emptynot1 | , |
backend | |||
) |
Definition at line 893 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND_NOT, Xapian::Query::OP_VALUE_GE, query(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | emptymaybe1 | , |
backend | |||
) |
Definition at line 919 of file api_query.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND_MAYBE, Xapian::Query::OP_VALUE_GE, query(), Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::size(), and TEST_EQUAL.
DEFINE_TESTCASE | ( | phraseweightcheckbug1 | , |
backend | |||
) |
Definition at line 943 of file api_query.cc.
References get_database(), Xapian::Query::get_description(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Query::OP_PHRASE, query(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and tout.
DEFINE_TESTCASE | ( | orphanedhint1 | , |
backend | |||
) |
Definition at line 955 of file api_query.cc.
References get_database(), Xapian::Query::get_description(), Xapian::Enquire::get_mset(), Xapian::Query::OP_WILDCARD, query(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and tout.
|
static |
Definition at line 795 of file api_query.cc.
References Xapian::WritableDatabase::add_document(), and Xapian::Document::add_term().
Referenced by DEFINE_TESTCASE().
|
static |
Definition at line 626 of file api_query.cc.
|
static |
Definition at line 595 of file api_query.cc.
|
static |
Definition at line 461 of file api_query.cc.