42 map<string, Xapian::doccount> tally;
48 tout <<
"Collapsing on slot " << slot <<
" max " << cmax <<
'\n';
54 map<string, Xapian::doccount>::const_iterator i;
55 for (i = tally.begin(); i != tally.end(); ++i) {
56 if (i->first.empty() || i->second <= cmax) {
57 expect_size += i->second;
66 map<string, Xapian::doccount> seen;
68 const string & key = j.get_collapse_key();
69 TEST(tally.find(key) != tally.end());
72 for (i = tally.begin(); i != tally.end(); ++i) {
73 if (i->first.empty() || i->second <= cmax) {
DEFINE_TESTCASE(collapsekey5, backend)
Simple test of collapsing with collapse_max > 1.
Xapian::Database get_database(const string &dbname)
test functionality of the Xapian API
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::Document get_document(Xapian::docid did) const
Get a document from the database, given its document id.
std::string get_value(Xapian::valueno slot) const
Get value by number.
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.
void set_collapse_key(Xapian::valueno collapse_key, Xapian::doccount collapse_max=1)
Set the collapse key to use for queries.
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.
Class representing a list of search results.
Xapian::doccount size() const
Return number of items in this MSet object.
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.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE doccount
A count of documents.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
std::ostringstream tout
The debug printing stream.
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST(a)
Test a condition, without an additional explanation for failure.
Xapian-specific test helper functions and macros.
Public interfaces for the Xapian library.