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) {
Xapian::doccount size() const
Return number of items in this MSet object.
Xapian::Document get_document(Xapian::docid did) const
Get a document from the database, given its document id.
DEFINE_TESTCASE(collapsekey5, backend)
Simple test of collapsing with collapse_max > 1.
#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.
Class representing a list of search results.
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
std::ostringstream tout
The debug printing stream.
Iterator over a Xapian::MSet.
Public interfaces for the Xapian library.
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.
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
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.
unsigned valueno
The number for a value slot in a document.
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.
void set_collapse_key(Xapian::valueno collapse_key, Xapian::doccount collapse_max=1)
Set the collapse key to use for queries.
std::string get_value(Xapian::valueno slot) const
Get value by number.