57 #define NOQ Xapian::Query::MatchNothing
232 for (
size_t subqgroup = 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);
316 tout << mset <<
'\n';
334 set<Xapian::docid> docids;
336 docids.insert(*mset1[i]);
344 TEST(docids.erase(*mset2[j]));
360 tout << mset_orig <<
'\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';
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())
DEFINE_TESTCASE(synonym1, backend)
static const synonym1_data_type synonym1_data[]
static void check_msets_contain_same_docs(const Xapian::MSet &mset1, const Xapian::MSet &mset2)
Xapian::Database get_database(const string &dbname)
test functionality of the Xapian API
Base class for backend handling in test harness.
This class is used to access a database, or a group of databases.
Xapian::doccount get_doccount() const
Get the number of documents in the database.
Xapian::termcount get_doclength_upper_bound() const
Get an upper bound on the length of a document in this DB.
This class provides an interface to the information retrieval system for the purpose of searching.
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
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.
Iterator over a Xapian::MSet.
double get_weight() const
Get the weight for the current position.
Class representing a list of search results.
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.
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.
Class representing a query.
@ OP_SCALE_WEIGHT
Scale the weight contributed by a subquery.
@ OP_MAX
Pick the maximum weight of any subquery.
@ OP_XOR
Match documents which an odd number of subqueries match.
@ OP_AND_MAYBE
Match the first subquery taking extra weight from other subqueries.
@ OP_AND
Match only documents which all subqueries match.
@ OP_OR
Match documents which at least one subquery matches.
@ OP_PHRASE
Match only documents where all subqueries match near and in order.
@ OP_SYNONYM
Match like OP_OR but weighting as if a single term.
@ OP_AND_NOT
Match documents which the first subquery matches but no others do.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
std::ostringstream tout
The debug printing stream.
a generic test suite engine
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST_EQUAL_DOUBLE(a, b)
Test two doubles for near equality.
#define TEST(a)
Test a condition, without an additional explanation for failure.
#define TEST_NOT_EQUAL(a, b)
Test for non-equality of two things.
bool mset_range_is_same(const Xapian::MSet &mset1, unsigned int first1, const Xapian::MSet &mset2, unsigned int first2, unsigned int count)
Xapian-specific test helper functions and macros.
Public interfaces for the Xapian library.