48 : num_docs(num_docs_), last_docid(last_docid_), did(0)
53 : num_docs(db.get_doccount()), last_docid(db.get_lastdocid()), did(0)
70 if (did % 2 == 0) ++did;
76 if (did % 2 == 0) ++did;
81 return did > last_docid;
146 : num_docs(num_docs_), last_docid(last_docid_), did(0)
153 : num_docs(db.get_doccount()), last_docid(db.get_lastdocid()), did(0)
163 return (did % 2) ? 1000 : 0.001;
185 return did > last_docid;
191 return "MyOddWeightingPostingSource";
207 mset_expect_order(mset, 1, 3, 5, 7, 9, 11, 13, 15, 17, 2);
249 : num_docs(num_docs_), last_docid(last_docid_), did(0)
264 FAIL_TEST(
"MyDontAskWeightPostingSource::get_weight() called");
286 return did > last_docid;
292 return "MyDontAskWeightPostingSource";
302 tout <<
"OP_SCALE_WEIGHT 0" << endl;
308 tout <<
"OP_FILTER" << endl;
317 tout <<
"BoolWeight" << endl;
332 tout <<
"RAW" << endl;
338 tout <<
"OP_FILTER" << endl;
347 tout <<
"OP_FILTER other way" << endl;
457 : did(0), maxid_accessed(maxid_accessed_) { }
462 if (did > maxid_accessed) {
463 FAIL_TEST(
"ChangeMaxweightPostingSource::get_weight() called " 464 "for docid " +
str(did) +
", max id accessed " 465 "should be " +
str(maxid_accessed));
476 set_maxweight(5 - did);
481 set_maxweight(5 - did);
595 :
Xapian::DecreasingValueWeightPostingSource(0), count(count_) { }
612 for (
int wt = 20; wt > 0; --wt) {
623 #ifndef HAVE_TIMER_CREATE 624 SKIP_TEST(
"Enquire::set_time_limit() not implemented for this platform");
651 :
Xapian::DecreasingValueWeightPostingSource(0),
652 doclen_lb(doclen_lb_),
653 doclen_ub(doclen_ub_) { }
692 : clone_count(clone_count_)
763 if (shard_index == 0) {
780 if (did > last_docid) did = 0;
786 if (did > last_docid) did = 0;
835 : lb(lb_), est(est_), ub(ub_)
849 FAIL_TEST(
"EstimatePS::next() shouldn't be called");
853 FAIL_TEST(
"EstimatePS::skip_to() shouldn't be called");
861 FAIL_TEST(
"EstimatePS::get_docid() shouldn't be called");
873 {411, 424, 439, 420},
876 {411, 426, 439, 430},
877 {123, 351, 439, 400},
884 {411, 416, 439, 420},
885 {411, 412, 439, 420},
887 {111, 133, 138, 130},
888 {111, 137, 138, 130},
890 {411, 415, 419, 415},
PostingSource * clone() const
Clone the posting source.
The Xapian namespace contains public interfaces for the Xapian library.
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::doccount size() const
Return number of items in this MSet object.
Xapian::docid add_document(const Xapian::Document &document)
Add a new document to the database.
bool check(Xapian::docid min_docid, double min_wt)
Check if the specified docid occurs.
void skip_to(Xapian::docid min_docid, double min_wt)
Advance to the specified docid.
string get_description() const
Return a string describing this object.
void add_value(Xapian::valueno slot, const std::string &value)
Add a new value.
Xapian::docid get_docid() const
Return the current docid.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Xapian::docid maxid_accessed
OnlyTheFirstPostingSource(bool allow_clone_)
void next(double wt)
Advance the current position to the next matching document.
double get_max_possible() const
The maximum possible weight any document could achieve.
void set_docid_order(docid_order order)
Set sort order for document IDs.
#define TEST(a)
Test a condition, without an additional explanation for failure.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
This class is used to access a database, or a group of databases.
std::string get_description() const
Return a string describing this object.
void set_cutoff(int percent_cutoff, double weight_cutoff=0)
Set the percentage and/or weight cutoffs.
Xapian::docid get_docid() const
Return the current docid.
EstimatePS(Xapian::doccount lb_, Xapian::doccount est_, Xapian::doccount ub_)
InvalidOperationError indicates the API was used in an invalid way.
void next(double wt)
Advance the current position to the next matching document.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
SlowDecreasingValueWeightPostingSource * clone() const
Clone the posting source.
Xapian::docid get_docid() const
Return the current docid.
Xapian::termcount get_doclength_lower_bound() const
Get a lower bound on the length of a document in this DB.
void next(double min_wt)
Advance the current position to the next matching document.
bool empty() const
Return true if this MSet object is empty.
Xapian::docid get_lastdocid() const
Get the highest document id which has been used in the database.
bool at_end() const
Return true if the current position is past the last entry in this list.
void sleep(double t)
Sleep until the time represented by this object.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
PostingSource * clone() const
Clone the posting source.
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.
Convert types to std::string.
void skip_to(Xapian::docid, double)
Advance to the specified docid.
static double est(double l, double r, double n)
std::string sortable_serialise(double value)
Convert a floating point number to a string, preserving sort order.
PostingSource * clone() const
Clone the posting source.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
MyOddWeightingPostingSource(Xapian::doccount num_docs_, Xapian::doccount last_docid_)
ChangeMaxweightPostingSource(Xapian::docid maxid_accessed_)
Xapian::doccount & doclen_ub
string get_description() const
Return a string describing this object.
PostingSource * clone() const
Clone the posting source.
Xapian::doccount get_doccount() const
Get the number of documents in the database.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
Xapian::docid get_docid() const
Return the current docid.
Xapian::doccount num_docs
Xapian::doccount num_docs
Xapian::doccount last_docid
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Read weights from a value which is known to decrease as docid increases.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
test functionality of the Xapian API
void next(double)
Advance the current position to the next matching document.
string get_description() const
Return a string describing this object.
void skip_to(Xapian::docid to_did, double wt)
Advance to the specified docid.
Xapian::doccount last_docid
void next(double wt)
Advance the current position to the next matching document.
#define TEST_REL(A, REL, B)
Test a relation holds,e.g. TEST_REL(a,>,b);.
MyOddWeightingPostingSource(const Xapian::Database &db)
InvalidArgumentError indicates an invalid parameter value was passed to the API.
Xapian::termcount get_doclength_upper_bound() const
Get an upper bound on the length of a document in this DB.
DEFINE_TESTCASE(externalsource1, backend &&!remote &&!multi)
Class implementing a "boolean" weighting scheme.
void next(double)
Advance the current position to the next matching document.
void init(const Xapian::Database &database)
Set this PostingSource to the start of the list of postings.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
bool at_end() const
Return true if the current position is past the last entry in this list.
void skip_to(Xapian::docid, double)
Advance to the specified docid.
This class provides read/write access to a database.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
std::ostringstream tout
The debug printing stream.
Iterator over a Xapian::MSet.
Scale the weight contributed by a subquery.
Match the first subquery taking extra weight from other subqueries.
bool at_end() const
Return true if the current position is past the last entry in this list.
Public interfaces for the Xapian library.
Match like OP_AND but only taking weight from the first subquery.
void init(const Xapian::Database &)
Set this PostingSource to the start of the list of postings.
string get_description() const
Return a string describing this object.
MyDontAskWeightPostingSource()
PostingSource * clone() const
Clone the posting source.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
A posting source which returns a fixed weight for all documents.
void set_time_limit(double time_limit)
Set a time limit for the match.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
#define TEST_EXCEPTION(TYPE, CODE)
Check that CODE throws exactly Xapian exception TYPE.
Xapian::docid get_docid() const
Return the current docid.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Xapian::docid get_docid() const
Return the current docid.
string get_description() const
Return a string describing this object.
PostingSource * clone() const
Clone the posting source.
void skip_to(Xapian::docid to_did, double 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 init(const Xapian::Database &)
Set this PostingSource to the start of the list of postings.
double get_weight() const
Return the weight contribution for the current document.
MyOddPostingSource(Xapian::doccount num_docs_, Xapian::doccount last_docid_)
string get_description() const
Return a string describing this object.
string str(int value)
Convert int to std::string.
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 init(const Xapian::Database &db)
Set this PostingSource to the start of the list of postings.
static Xapian::doccount shard_index
bool at_end() const
Return true if the current position is past the last entry in this list.
void skip_to(Xapian::docid min_docid, double min_wt)
Advance to the specified docid.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
Xapian::doccount last_docid
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
void init(const Database &db_)
Set this PostingSource to the start of the list of postings.
Base class which provides an "external" source of postings.
Xapian::docid get_docid() const
Return the current docid.
double get_weight() const
Return the weight contribution for the current document.
#define TEST_EQUAL_DOUBLE(a, b)
Test two doubles for near equality.
CheckBoundsPostingSource(Xapian::doccount &doclen_lb_, Xapian::doccount &doclen_ub_)
void set_query(const Xapian::Query &query, Xapian::termcount qlen=0)
Set the query to run.
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
void skip_to(Xapian::docid to_did, double wt)
Advance to the specified docid.
bool at_end() const
Return true if the current position is past the last entry in this list.
A posting source which reads weights from a value slot.
#define FAIL_TEST(MSG)
Fail the current testcase with message MSG.
CheckBoundsPostingSource * clone() const
Clone the posting source.
Match only documents which all subqueries match.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
Xapian::Database get_database(const string &dbname)
Xapian::doccount last_docid
Xapian::doccount get_matches_estimated() const
Estimate of the total number of matching documents.
bool at_end() const
Return true if the current position is past the last entry in this list.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
MyOddPostingSource(const Xapian::Database &db)
#define SKIP_TEST(MSG)
Skip the current testcase with message MSG.
void skip_to(Xapian::docid to_did, double wt)
Advance to the specified docid.
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.
CloneTestPostingSource(int &clone_count_)
void init(const Xapian::Database &db_)
Set this PostingSource to the start of the list of postings.
bool at_end() const
Return true if the current position is past the last entry in this list.
void next(double)
Advance the current position to the next matching document.
Xapian::doccount & doclen_lb
PostingSource subclass for injecting tf bounds and estimate.
Xapian::docid get_docid() const
Return the current docid.
Match documents which at least one subquery matches.
Xapian-specific test helper functions and macros.
void init(const Xapian::Database &)
Set this PostingSource to the start of the list of postings.
Xapian::doccount get_termfreq_min() const
A lower bound on the number of documents this object can return.
MyDontAskWeightPostingSource(Xapian::doccount num_docs_, Xapian::doccount last_docid_)
void init(const Xapian::Database &db)
Set this PostingSource to the start of the list of postings.
Xapian::doccount num_docs
Xapian::doccount get_termfreq_max() const
An upper bound on the number of documents this object can return.
PostingSource * release()
Start reference counting this object.
<unistd.h>, but with compat.
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)
double get_maxweight() const
Return the currently set upper bound on what get_weight() can return.
void next(double min_wt)
Advance the current position to the next matching document.
Xapian::docid get_docid() const
Return the current docid.
void next(double min_wt)
Advance the current position to the next matching document.
void set_weighting_scheme(const Weight &weight_)
Set the weighting scheme to use for queries.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
Class representing a query.
void init(const Xapian::Database &)
Set this PostingSource to the start of the list of postings.
static void make_matchtimelimit1_db(Xapian::WritableDatabase &db, const string &)
double get_weight() const
Return the weight contribution for the current document.
#define TEST_EQUAL(a, b)
Test for equality of two things.
SlowDecreasingValueWeightPostingSource(int &count_)
void init(const Xapian::Database &)
Set this PostingSource to the start of the list of postings.
void next(double wt)
Advance the current position to the next matching document.
void skip_to(Xapian::docid to_did, double)
Advance to the specified docid.
A handle representing a document in a Xapian database.
UnimplementedError indicates an attempt to use an unimplemented feature.
string get_description() const
Return a string describing this object.
Xapian::doccount get_termfreq_est() const
An estimate of the number of documents this object can return.
docids sort in descending order.
static const testcase testcases[]