57 #define NOQ Xapian::Query::MatchNothing 232 for (
size_t subqgroup = 0;
233 subqgroup !=
sizeof(
synonym1_data) /
sizeof(synonym1_data[0]);
253 tout <<
"Comparing " << orquery <<
" with " << synquery <<
'\n';
259 map<Xapian::docid, double> values_or;
260 map<Xapian::docid, double> values_synonym;
262 values_or[*ormset[i]] = ormset[i].get_weight();
263 values_synonym[*synmset[i]] = synmset[i].get_weight();
265 TEST_EQUAL(values_or.size(), values_synonym.size());
270 int different_weight = 0;
271 for (map<Xapian::docid, double>::const_iterator
272 j = values_or.begin(); j != values_or.end(); ++j) {
276 TEST(values_synonym.find(did) != values_synonym.end());
277 if (values_or[did] == values_synonym[did]) {
299 vector<Xapian::Query> subqueries;
306 subqueries.push_back(query);
310 tout << query <<
'\n';
316 tout << mset <<
'\n';
334 set<Xapian::docid> docids;
336 docids.insert(*mset1[i]);
344 TEST(docids.erase(*mset2[j]));
359 tout << query <<
'\n';
360 tout << mset_orig <<
'\n';
368 tout << query <<
'\n';
369 tout << mset_zero <<
'\n';
404 end = operators +
sizeof(operators) /
sizeof(operators[0]);
411 tout <<
"query1:" << query1 <<
'\n';
413 tout <<
"mset1:" << mset1 <<
'\n';
415 tout <<
"query2:" << query2 <<
'\n';
417 tout <<
"mset2:" << mset2 <<
'\n';
423 TEST(mset1[0].get_percent() != 100);
444 map<Xapian::docid, double> expected_weights;
446 for (i = mset1.
begin(); i != mset1.
end(); ++i) {
449 for (i = mset2.
begin(); i != mset2.
end(); ++i) {
450 map<Xapian::docid, double>::iterator j;
451 j = expected_weights.find(*i);
452 if (j != expected_weights.end()) {
459 for (i = msetmax.
begin(); i != msetmax.
end(); ++i) {
460 map<Xapian::docid, double>::iterator j;
461 j = expected_weights.find(*i);
462 TEST(j != expected_weights.end());
464 expected_weights.erase(j);
465 tout << expected_weights.size() <<
'\n';
Xapian::doccount size() const
Return number of items in this MSet object.
double get_max_possible() const
The maximum possible weight any document could achieve.
#define TEST(a)
Test a condition, without an additional explanation for failure.
This class is used to access a database, or a group of databases.
Match documents which an odd number of subqueries match.
bool mset_range_is_same(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
a generic test suite engine
Class representing a list of search results.
Pick the maximum weight of any subquery.
MSet get_mset(Xapian::doccount first, Xapian::doccount maxitems, Xapian::doccount checkatleast=0, const RSet *omrset=0, const MatchDecider *mdecider=0) const
Get (a portion of) the match set for the current query.
Xapian::doccount get_doccount() const
Get the number of documents in the database.
test functionality of the Xapian API
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
#define TEST_NOT_EQUAL(a, b)
Test for non-equality of two things.
Xapian::termcount get_doclength_upper_bound() const
Get an upper bound on the length of a document in this DB.
Base class for backend handling in test harness.
std::ostringstream tout
The debug printing stream.
Iterator over a Xapian::MSet.
Scale the weight contributed by a subquery.
Match only documents where all subqueries match near and in order.
Match the first subquery taking extra weight from other subqueries.
Public interfaces for the Xapian library.
DEFINE_TESTCASE(synonym1, backend)
MSetIterator begin() const
Return iterator pointing to the first item in this MSet.
MSetIterator end() const
Return iterator pointing to just after the last item in this MSet.
#define TEST_EQUAL_DOUBLE(a, b)
Test two doubles for near equality.
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
static const synonym1_data_type synonym1_data[]
Match like OP_OR but weighting as if a single term.
static void check_msets_contain_same_docs(const Xapian::MSet &mset1, const Xapian::MSet &mset2)
double get_weight() const
Get the weight for the current position.
Match only documents which all subqueries match.
static Xapian::Query query(Xapian::Query::op op, const string &t1=string(), const string &t2=string(), const string &t3=string(), const string &t4=string(), const string &t5=string(), const string &t6=string(), const string &t7=string(), const string &t8=string(), const string &t9=string(), const string &t10=string())
Xapian::Database get_database(const string &dbname)
This class provides an interface to the information retrieval system for the purpose of searching...
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
Match documents which the first subquery matches but no others do.
Match documents which at least one subquery matches.
Xapian-specific test helper functions and macros.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Class representing a query.
#define TEST_EQUAL(a, b)
Test for equality of two things.