42 list<string> answers_list;
43 answers_list.push_back(
"one");
44 answers_list.push_back(
"two");
45 answers_list.push_back(
"three");
46 answers_list.push_back(
"four");
62 TEST(list1 == answers_list);
64 TEST(list2 == answers_list);
82 vector<Xapian::Query> v;
97 for (
size_t i = 0; i <
sizeof(ops) /
sizeof(ops[0]); ++i) {
98 tout <<
"Testing op #" << i <<
'\n';
142 vector<string> v1(terms, terms + 3);
143 vector<Xapian::Query> v2(queries, queries + 3);
144 vector<Xapian::Query *> v3;
147 v3.push_back(&query1);
148 v3.push_back(&query2);
151 tout <<
"myq1=" << myq1 <<
"\n";
155 tout <<
"myq2_1=" << myq2_1 <<
"\n";
159 tout <<
"myq2_2=" << myq2_2 <<
"\n";
163 tout <<
"myq2=" << myq2 <<
"\n";
167 tout <<
"myquery=" << myquery <<
"\n";
190 vector<Xapian::Query> vec1(queries1, queries1 + 3);
193 "Query((wibble OR wobble OR (jelly OR belly)))");
195 vector<Xapian::Query> vec2(queries2, queries2 + 3);
198 "Query(((jelly AND belly) AND wibble AND wobble))");
203 vector<string> emptyterms;
213 tout <<
"available languages '" << langs <<
"'\n";
214 TEST(!langs.empty());
217 langs +=
" ar hy eu ca da nl en fi fr de hu id ga it lt ne nb nn no pt ro"
220 string::size_type i = 0;
222 string::size_type spc = langs.find(
' ', i);
230 tout <<
"checking language code '" <<
language <<
"' works\n";
234 string expected(
"Xapian::Stem(");
240 if (spc == string::npos)
break;
264 FAIL_TEST(
"Managed to open 'NOsuChdaTabASe'");
273 FAIL_TEST(
"Managed to check 'NOsuChdaTabASe'");
279 "Couldn't find Xapian database or table to check");
393 string prefix =
"tw";
395 TEST(!decider(
"one"));
398 TEST(!decider(
"Two"));
399 TEST(decider(
"two"));
400 TEST(decider(
"twitter"));
401 TEST(decider(prefix));
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())
DEFINE_TESTCASE(getqterms1, !backend)
test functionality of the Xapian API
DatabaseOpeningError indicates failure to open a database.
An indexed database of documents.
static size_t check(std::string_view path, int opts=0, std::ostream *out=NULL)
Check the integrity of a database or database table.
Class representing a document.
std::string get_value(Xapian::valueno slot) const
Read a value slot in this document.
void remove_value(Xapian::valueno slot)
Remove any value from the specified slot.
void add_value(Xapian::valueno slot, std::string_view value)
Add a value to a slot in this document.
const std::string & get_msg() const noexcept
Message giving details of the error, intended for human consumption.
ExpandDecider subclass which restrict terms to a particular prefix.
InvalidArgumentError indicates an invalid parameter value was passed to the API.
Class representing a list of search results.
Xapian::doccount get_termfreq(std::string_view term) const
Get the termfreq of a term.
double get_termweight(std::string_view term) const
Get the term weight of a term.
Class representing a query.
const TermIterator get_terms_begin() const
Begin iterator for terms in the query object.
const TermIterator get_unique_terms_begin() const
Begin iterator for unique terms in the query object.
std::string get_description() const
Return a string describing this object.
const TermIterator get_unique_terms_end() const noexcept
End iterator for unique terms in the query object.
const TermIterator get_terms_end() const noexcept
End iterator for terms in the query object.
@ OP_SCALE_WEIGHT
Scale the weight contributed by a subquery.
@ OP_XOR
Match documents which an odd number of subqueries match.
@ OP_AND_MAYBE
Match the first subquery taking extra weight from other subqueries.
@ OP_AND
Match only documents which all subqueries match.
@ OP_OR
Match documents which at least one subquery matches.
@ OP_AND_NOT
Match documents which the first subquery matches but no others do.
static const Xapian::Query MatchNothing
A query matching no documents.
bool empty() const noexcept
Check if this query is Xapian::Query::MatchNothing.
Xapian::termcount get_length() const noexcept
Return the length of this query object.
Class representing a set of documents judged as relevant.
void add_document(Xapian::docid did)
Mark a document as relevant.
Xapian::doccount size() const
Return number of documents in this RSet object.
bool empty() const
Return true if this RSet object is empty.
std::string get_description() const
Return a string describing this object.
Class representing a stemming algorithm.
static std::string get_available_languages()
Return a list of available languages.
std::string get_description() const
Return a string describing this object.
bool is_none() const
Return true if this is a no-op stemmer.
Class for iterating over a list of terms.
MatchDecider filtering results based on whether document values are in a user-defined set.
void remove_value(const std::string &value)
Remove a value from the test set.
void add_value(const std::string &value)
Add a value to the test set.
unsigned XAPIAN_DOCID_BASE_TYPE docid
A unique identifier for a document.
static Xapian::Stem stemmer
std::ostringstream tout
The debug printing stream.
a generic test suite engine
#define FAIL_TEST(MSG)
Fail the current testcase with message MSG.
#define TEST_EQUAL(a, b)
Test for equality of two things.
#define TEST_STRINGS_EQUAL(a, b)
Test for equality of two strings.
#define TEST(a)
Test a condition, without an additional explanation for failure.
#define TEST_NOT_EQUAL(a, b)
Test for non-equality of two things.
Xapian-specific test helper functions and macros.
#define TEST_EXCEPTION(TYPE, CODE)
Check that CODE throws exactly Xapian exception TYPE.
Public interfaces for the Xapian library.