48 list<string> answers_list;
49 answers_list.push_back(
"one");
50 answers_list.push_back(
"two");
51 answers_list.push_back(
"three");
52 answers_list.push_back(
"four");
68 TEST(list1 == answers_list);
70 TEST(list2 == answers_list);
88 vector<Xapian::Query> v;
103 for (
size_t i = 0; i <
sizeof(ops) /
sizeof(ops[0]); ++i) {
104 tout <<
"Testing op #" << i << endl;
148 vector<string> v1(terms, terms + 3);
149 vector<Xapian::Query> v2(queries, queries + 3);
150 vector<Xapian::Query *> v3;
153 v3.push_back(&query1);
154 v3.push_back(&query2);
157 tout <<
"myq1=" << myq1 <<
"\n";
161 tout <<
"myq2_1=" << myq2_1 <<
"\n";
165 tout <<
"myq2_2=" << myq2_2 <<
"\n";
169 tout <<
"myq2=" << myq2 <<
"\n";
173 tout <<
"myquery=" << myquery <<
"\n";
180 tout <<
"XOR (\"foo\", \"bar\") checked" << endl;
202 vector<Xapian::Query> vec1(queries1, queries1 + 3);
205 "Query((wibble OR wobble OR (jelly OR belly)))");
207 vector<Xapian::Query> vec2(queries2, queries2 + 3);
210 "Query(((jelly AND belly) AND wibble AND wobble))");
215 vector<string> emptyterms;
225 tout <<
"available languages '" << langs <<
"'" << endl;
226 TEST(!langs.empty());
229 langs +=
" ar hy eu ca da nl en fi fr de hu id ga it lt ne nb nn no pt ro" 232 string::size_type i = 0;
234 string::size_type spc = langs.find(
' ', i);
242 tout <<
"checking language code '" << language <<
"' works" << endl;
245 if (language.size() > 2) {
246 string expected(
"Xapian::Stem(");
252 if (spc == string::npos)
break;
376 TEST_EQUAL(dlhweight.name(),
"Xapian::DLHWeight");
378 TEST_EQUAL(dlhweight.serialise(), wt->serialise());
404 TEST_EQUAL(dphweight.name(),
"Xapian::DPHWeight");
406 TEST_EQUAL(dphweight.serialise(), wt->serialise());
423 FAIL_TEST(
"Managed to open 'NOsuChdaTabASe'");
432 FAIL_TEST(
"Managed to check 'NOsuChdaTabASe'");
438 "Couldn't find Xapian database or table to check");
548 string prefix =
"tw";
550 TEST(!decider(
"one"));
553 TEST(!decider(
"Two"));
554 TEST(decider(
"two"));
555 TEST(decider(
"twitter"));
556 TEST(decider(prefix));
const TermIterator get_unique_terms_end() const
End iterator for unique terms in the query object.
Xapian::termcount get_length() const
Return the length of this query object.
bool is_none() const
Return true if this is a no-op stemmer.
ExpandDecider subclass which restrict terms to a particular prefix.
Xapian::doccount size() const
The number of documents in this R-Set.
void add_value(Xapian::valueno slot, const std::string &value)
Add a new value.
MatchDecider filtering results based on whether document values are in a user-defined set...
static size_t check(const std::string &path, int opts=0, std::ostream *out=NULL)
Check the integrity of a database or database table.
#define TEST(a)
Test a condition, without an additional explanation for failure.
std::string get_description() const
Return a string describing this object.
This class is used to access a database, or a group of databases.
DEFINE_TESTCASE(trivial1, !backend)
Match documents which an odd number of subqueries match.
std::string serialise() const
Return this object's parameters serialised as a single string.
InvalidOperationError indicates the API was used in an invalid way.
const TermIterator get_terms_begin() const
Begin iterator for terms in the query object.
InL2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
DatabaseOpeningError indicates failure to open a database.
Class representing a stemming algorithm.
PL2PlusWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
void remove_value(const std::string &value)
Remove a value from the test set.
std::string serialise() const
Return this object's parameters serialised as a single string.
const std::string & get_msg() const
Message giving details of the error, intended for human consumption.
a generic test suite engine
void add_value(const std::string &value)
Add a value to the test set.
Class representing a list of search results.
This class implements the InL2 weighting scheme.
std::string serialise() const
Return this object's parameters serialised as a single string.
std::string serialise() const
Return this object's parameters serialised as a single string.
std::string serialise() const
Return this object's parameters serialised as a single string.
BM25PlusWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
Xapian::Weight subclass implementing the PL2+ probabilistic formula.
static Xapian::Stem stemmer
std::string serialise() const
Return this object's parameters serialised as a single string.
std::string serialise() const
Return this object's parameters serialised as a single string.
void remove_value(Xapian::valueno slot)
Remove any value with the given number.
const TermIterator get_unique_terms_begin() const
Begin iterator for unique terms in the query object.
test functionality of the Xapian API
std::string name() const
Return the name of this weighting scheme.
std::string name() const
Return the name of this weighting scheme.
std::string name() const
Return the name of this weighting scheme.
This class implements the BB2 weighting scheme.
Class for iterating over a list of terms.
#define TEST_NOT_EQUAL(a, b)
Test for non-equality of two things.
IfB2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
Xapian::Weight subclass implementing Coordinate Matching.
BM25Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
std::string name() const
Return the name of this weighting scheme.
TfIdfWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
Class implementing a "boolean" weighting scheme.
std::ostringstream tout
The debug printing stream.
Scale the weight contributed by a subquery.
Match the first subquery taking extra weight from other subqueries.
std::string get_description() const
Return a string describing this object.
Public interfaces for the Xapian library.
std::string serialise() const
Return this object's parameters serialised as a single string.
static std::string get_available_languages()
Return a list of available languages.
DPHWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
#define TEST_EXCEPTION(TYPE, CODE)
Check that CODE throws exactly Xapian exception TYPE.
std::string name() const
Return the name of this weighting scheme.
IneB2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
std::string name() const
Return the name of this weighting scheme.
std::string name() const
Return the name of this weighting scheme.
Xapian::Weight subclass implementing the traditional probabilistic formula.
std::string serialise() const
Return this object's parameters serialised as a single string.
This class implements the DLH weighting scheme, which is a representative scheme of the Divergence fr...
std::string name() const
Return the name of this weighting scheme.
This class implements the PL2 weighting scheme.
This class implements the IneB2 weighting scheme.
BoolWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
std::string name() const
Return the name of this weighting scheme.
std::string serialise() const
Return this object's parameters serialised as a single string.
std::string serialise() const
Return this object's parameters serialised as a single string.
void add_document(Xapian::docid did)
Add a document to the relevance set.
This class implements the IfB2 weighting scheme.
#define FAIL_TEST(MSG)
Fail the current testcase with message MSG.
Match only documents which all subqueries match.
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())
std::string name() const
Return the name of this weighting scheme.
std::string get_description() const
Return a string describing this object.
This class provides an interface to the information retrieval system for the purpose of searching...
CoordWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
std::string serialise() const
Return this object's parameters serialised as a single string.
PL2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
This class implements the DPH weighting scheme.
bool empty() const
Check if this query is Xapian::Query::MatchNothing.
Match documents which the first subquery matches but no others do.
Match documents which at least one subquery matches.
Xapian-specific test helper functions and macros.
std::string name() const
Return the name of this weighting scheme.
static const Xapian::Query MatchNothing
A query matching no documents.
LMWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
#define TEST_STRINGS_EQUAL(a, b)
Test for equality of two strings.
Xapian::doccount get_termfreq(const std::string &term) const
Get the termfreq of a term.
std::string name() const
Return the name of this weighting scheme.
Class representing a query.
#define TEST_EQUAL(a, b)
Test for equality of two things.
bool empty() const
Test if this R-Set is empty.
Xapian::Weight subclass implementing the Language Model formula.
const TermIterator get_terms_end() const
End iterator for terms in the query object.
BB2Weight * unserialise(const std::string &serialised) const
Unserialise parameters.
std::string serialise() const
Return this object's parameters serialised as a single string.
std::string get_value(Xapian::valueno slot) const
Get value by number.
A handle representing a document in a Xapian database.
Xapian::Weight subclass implementing the BM25+ probabilistic formula.
std::string name() const
Return the name of this weighting scheme.
Xapian::Weight subclass implementing the BM25 probabilistic formula.
Xapian::Weight subclass implementing the tf-idf weighting scheme.
Abstract base class for weighting schemes.
TradWeight * unserialise(const std::string &serialised) const
Unserialise parameters.
DLHWeight * unserialise(const std::string &serialised) const
Unserialise parameters.