39 tout <<
"testing valuestream iteration for slot " << slot <<
'\n';
59 unsigned interval = 1;
60 while (interval < 1999) {
62 tout <<
"testing valuestream skip_to for slot " << slot
63 <<
" with interval " << interval <<
'\n';
74 while (did < actual_did) {
84 interval = interval * 3 - 1;
95 CHECK, CHECK_AND_NEXT, CHECK2, SKIP_TO, CHECK_AND_LOOP
97 test_op operation = CHECK;
100 unsigned interval = 1;
101 while (interval < 1999) {
102 tout <<
"testing valuestream check for slot " << slot
103 <<
" with interval " << interval <<
'\n';
108 bool positioned =
true;
113 case CHECK:
case CHECK2:
114 positioned = it.
check(did);
116 case CHECK_AND_NEXT: {
117 bool was_skip_to = it.
check(did);
118 if (!was_skip_to) ++it;
125 operation = test_op(operation + 1);
133 while (did < actual_did) {
144 interval = interval * 3 - 1;
169 SKIP_TEST(
"Testcase is too slow with remote shards");
static void gen_decvalwtsource5_db(Xapian::WritableDatabase &db, const string &)
static void gen_valueweightsource5_db(Xapian::WritableDatabase &db, const string &)
DEFINE_TESTCASE(valuestream1, backend)
Feature test simple valuestream iteration.
static void gen_decvalwtsource3_db(Xapian::WritableDatabase &db, const string &)
Xapian::WritableDatabase get_writable_database(const string &dbname)
Xapian::Database get_database(const string &dbname)
test functionality of the Xapian API
#define SKIP_TEST_FOR_BACKEND(B)
An indexed database of documents.
ValueIterator valuestream_begin(Xapian::valueno slot) const
Return an iterator over the value in slot slot for each document.
ValueIterator valuestream_end(Xapian::valueno) const noexcept
Return end iterator corresponding to valuestream_begin().
Xapian::Document get_document(Xapian::docid did, unsigned flags=0) const
Get a document from the database.
Read weights from a value which is known to decrease as docid increases.
bool check(Xapian::docid min_docid, double min_wt) override
Check if the specified docid occurs.
void reset(const Database &db_, Xapian::doccount shard_index) override
Set this PostingSource to the start of the list of postings.
void skip_to(Xapian::docid min_docid, double min_wt) override
Advance to the specified docid.
void next(double min_wt) override
Advance the current position to the next matching document.
Class representing a document.
void add_term(std::string_view term, Xapian::termcount wdf_inc=1)
Add a term to this document.
std::string get_value(Xapian::valueno slot) const
Read a value slot in this document.
void add_value(Xapian::valueno slot, std::string_view value)
Add a value to a slot in this document.
MSet get_mset(doccount first, doccount maxitems, doccount checkatleast=0, const RSet *rset=NULL, const MatchDecider *mdecider=NULL) const
Run the query.
void set_query(const Query &query, termcount query_length=0)
Set the query.
A posting source which returns a fixed weight for all documents.
void next(double min_wt) override
Advance the current position to the next matching document.
bool at_end() const override
Return true if the current position is past the last entry in this list.
void reset(const Database &db_, Xapian::doccount shard_index) override
Set this PostingSource to the start of the list of postings.
void skip_to(Xapian::docid min_docid, double min_wt) override
Advance to the specified docid.
Class representing a list of search results.
Xapian::doccount size() const
Return number of items in this MSet object.
Class representing a query.
Class for iterating over document values.
Xapian::docid get_docid() const
Return the docid at the current position.
Xapian::valueno get_valueno() const
Return the value slot number for the current position.
bool check(Xapian::docid docid)
Check if the specified docid occurs.
void skip_to(Xapian::docid docid_or_slot)
Advance the iterator to document id or value slot docid_or_slot.
A posting source which looks up weights in a map using values as the key.
void add_mapping(const std::string &key, double wt)
Add a mapping.
void reset(const Database &db_, Xapian::doccount shard_index) override
Set this PostingSource to the start of the list of postings.
void clear_mappings()
Clear all mappings.
void set_default_weight(double wt)
Set a default weight for document values not in the map.
void skip_to(Xapian::docid min_docid, double min_wt)
Advance to the specified docid.
bool at_end() const
Return true if the current position is past the last entry in this list.
void next(double min_wt)
Advance the current position to the next matching document.
bool check(Xapian::docid min_docid, double min_wt)
Check if the specified docid occurs.
Xapian::docid get_docid() const
Return the current docid.
A posting source which reads weights from a value slot.
void reset(const Database &db_, Xapian::doccount shard_index)
Set this PostingSource to the start of the list of postings.
This class provides read/write access to a database.
void replace_document(Xapian::docid did, const Xapian::Document &document)
Replace a document in the database.
void commit()
Commit pending modifications.
Xapian::docid add_document(const Xapian::Document &doc)
Add a document to the database.
std::string sortable_serialise(double value)
Convert a floating point number to a string, preserving sort order.
unsigned valueno
The number for a value slot in a document.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
bool contains(std::string_view s, char substring)
#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 SKIP_TEST(MSG)
Skip the current testcase with message MSG.
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST(a)
Test a condition, without an additional explanation for failure.
void mset_expect_order(const Xapian::MSet &A, Xapian::docid d1, Xapian::docid d2, Xapian::docid d3, Xapian::docid d4, Xapian::docid d5, Xapian::docid d6, Xapian::docid d7, Xapian::docid d8, Xapian::docid d9, Xapian::docid d10, Xapian::docid d11, Xapian::docid d12)
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.