xapian-core  1.4.26
Classes | Macros | Functions
api_anydb.cc File Reference

tests which work with any backend More...

#include <config.h>
#include "api_anydb.h"
#include <algorithm>
#include <string>
#include <xapian.h>
#include "testsuite.h"
#include "testutils.h"
#include "apitest.h"
#include <list>
+ Include dependency graph for api_anydb.cc:

Go to the source code of this file.

Classes

class  EvenParityExpandFunctor
 

Macros

#define XAPIAN_DEPRECATED(X)   X
 

Functions

static void print_mset_weights (const Xapian::MSet &mset)
 
static void print_mset_percentages (const Xapian::MSet &mset)
 
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())
 
static Xapian::Query query (Xapian::Query::op op, Xapian::termcount parameter, 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())
 
static Xapian::Query query (const string &t)
 
 DEFINE_TESTCASE (zerodocid1, backend)
 
 DEFINE_TESTCASE (emptyquery1, backend)
 
 DEFINE_TESTCASE (simplequery1, backend)
 
 DEFINE_TESTCASE (simplequery2, backend)
 
 DEFINE_TESTCASE (simplequery3, backend)
 
 DEFINE_TESTCASE (multidb2, backend &&!multi)
 
 DEFINE_TESTCASE (msetmaxitems1, backend)
 
 DEFINE_TESTCASE (expandweights1, backend)
 
 DEFINE_TESTCASE (expandweights2, backend)
 
 DEFINE_TESTCASE (expandweights3, backend)
 
 DEFINE_TESTCASE (expandweights4, backend)
 
 DEFINE_TESTCASE (expandweights5, backend)
 
 DEFINE_TESTCASE (expandweights6, backend)
 
 DEFINE_TESTCASE (expandweights7, backend)
 
 DEFINE_TESTCASE (expandweights8, backend)
 
 DEFINE_TESTCASE (expandmaxitems1, backend)
 
 DEFINE_TESTCASE (boolquery1, backend)
 
 DEFINE_TESTCASE (msetfirst1, backend)
 
 DEFINE_TESTCASE (topercent1, backend)
 
 DEFINE_TESTCASE (topercent2, backend)
 
 DEFINE_TESTCASE (expandfunctor1, backend)
 
 DEFINE_TESTCASE (expanddeciderfilterprefix2, backend)
 
 DEFINE_TESTCASE (pctcutoff1, backend)
 
 DEFINE_TESTCASE (pctcutoff2, backend)
 
 DEFINE_TESTCASE (pctcutoff3, backend)
 
 DEFINE_TESTCASE (cutoff1, backend)
 
 DEFINE_TESTCASE (allowqterms1, backend)
 
 DEFINE_TESTCASE (maxattain1, backend)
 
 DEFINE_TESTCASE (reversebool1, backend)
 
 DEFINE_TESTCASE (reversebool2, backend)
 
 DEFINE_TESTCASE (getmterms1, backend)
 
 DEFINE_TESTCASE (getmterms2, backend)
 
 DEFINE_TESTCASE (repeatquery1, backend)
 
 DEFINE_TESTCASE (fetchdocs1, backend)
 
 DEFINE_TESTCASE (absentterm1, backend)
 
 DEFINE_TESTCASE (absentterm2, backend)
 
 DEFINE_TESTCASE (rset1, backend)
 
 DEFINE_TESTCASE (rset2, backend)
 Test that an RSet affects MSet result order. More...
 
 DEFINE_TESTCASE (rsetmultidb1, backend &&!multi)
 
 DEFINE_TESTCASE (rsetmultidb3, backend &&!multi)
 
 DEFINE_TESTCASE (eliteset1, backend &&!multi)
 Simple test of the elite set operator. More...
 
 DEFINE_TESTCASE (elitesetmulti1, multi)
 Multi-backend variant of eliteset1. More...
 
 DEFINE_TESTCASE (eliteset2, backend &&!multi)
 Test that the elite set operator works if the set contains sub-expressions (regression test) More...
 
 DEFINE_TESTCASE (elitesetmulti2, multi)
 Multi-backend variant of eliteset2. More...
 
 DEFINE_TESTCASE (eliteset3, backend)
 Test that elite set doesn't affect query results if we have fewer terms than the threshold. More...
 
 DEFINE_TESTCASE (eliteset4, backend &&!multi)
 Test that elite set doesn't pick terms with 0 frequency. More...
 
 DEFINE_TESTCASE (elitesetmulti4, multi)
 Multi-backend variant of eliteset4. More...
 
 DEFINE_TESTCASE (eliteset5, backend)
 Regression test for problem with excess precision. More...
 
 DEFINE_TESTCASE (termlisttermfreq1, backend)
 Test that the termfreq returned by termlists is correct. More...
 
 DEFINE_TESTCASE (qterminfo1, backend)
 Test the termfreq and termweight info returned for query terms. More...
 
 DEFINE_TESTCASE (qterminfo2, backend)
 Regression test for bug #37. More...
 
 DEFINE_TESTCASE (msetzeroitems1, backend)
 
 DEFINE_TESTCASE (matches1, backend)
 
 DEFINE_TESTCASE (wqf1, backend)
 
 DEFINE_TESTCASE (qlen1, backend)
 
 DEFINE_TESTCASE (termlist1, backend)
 
 DEFINE_TESTCASE (termlist2, backend)
 
static Xapian::TermIterator test_termlist3_helper ()
 
 DEFINE_TESTCASE (termlist3, backend)
 
 DEFINE_TESTCASE (termlist4, backend)
 
 DEFINE_TESTCASE (puncterms1, backend)
 
 DEFINE_TESTCASE (spaceterms1, backend)
 
 DEFINE_TESTCASE (xor1, backend)
 
 DEFINE_TESTCASE (xor2, backend)
 Test that weighted XOR queries work (bug fixed in 1.2.1 and 1.0.21). More...
 
 DEFINE_TESTCASE (getdoc1, backend)
 
 DEFINE_TESTCASE (emptyop1, backend)
 
 DEFINE_TESTCASE (checkatleast1, backend)
 
 DEFINE_TESTCASE (checkatleast2, backend)
 
 DEFINE_TESTCASE (checkatleast3, backend)
 
 DEFINE_TESTCASE (allpostlist1, backend)
 
static void test_emptyterm1_helper (Xapian::Database &db)
 
 DEFINE_TESTCASE (emptyterm1, backend)
 
 DEFINE_TESTCASE (alldocspl1, backend)
 
 DEFINE_TESTCASE (alldocspl2, writable)
 
 DEFINE_TESTCASE (scaleweight1, backend)
 
 DEFINE_TESTCASE (scaleweight2, backend)
 
 DEFINE_TESTCASE (uuid1, backend &&!multi)
 

Detailed Description

tests which work with any backend

Definition in file api_anydb.cc.

Macro Definition Documentation

◆ XAPIAN_DEPRECATED

#define XAPIAN_DEPRECATED (   X)    X

Definition at line 33 of file api_anydb.cc.

Function Documentation

◆ DEFINE_TESTCASE() [1/75]

DEFINE_TESTCASE ( zerodocid1  ,
backend   
)

◆ DEFINE_TESTCASE() [2/75]

DEFINE_TESTCASE ( emptyquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [3/75]

DEFINE_TESTCASE ( simplequery1  ,
backend   
)

◆ DEFINE_TESTCASE() [4/75]

DEFINE_TESTCASE ( simplequery2  ,
backend   
)

◆ DEFINE_TESTCASE() [5/75]

DEFINE_TESTCASE ( simplequery3  ,
backend   
)

◆ DEFINE_TESTCASE() [6/75]

DEFINE_TESTCASE ( multidb2  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [7/75]

DEFINE_TESTCASE ( msetmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [8/75]

DEFINE_TESTCASE ( expandweights1  ,
backend   
)

◆ DEFINE_TESTCASE() [9/75]

DEFINE_TESTCASE ( expandweights2  ,
backend   
)

◆ DEFINE_TESTCASE() [10/75]

DEFINE_TESTCASE ( expandweights3  ,
backend   
)

◆ DEFINE_TESTCASE() [11/75]

DEFINE_TESTCASE ( expandweights4  ,
backend   
)

◆ DEFINE_TESTCASE() [12/75]

DEFINE_TESTCASE ( expandweights5  ,
backend   
)

◆ DEFINE_TESTCASE() [13/75]

DEFINE_TESTCASE ( expandweights6  ,
backend   
)

◆ DEFINE_TESTCASE() [14/75]

DEFINE_TESTCASE ( expandweights7  ,
backend   
)

◆ DEFINE_TESTCASE() [15/75]

DEFINE_TESTCASE ( expandweights8  ,
backend   
)

◆ DEFINE_TESTCASE() [16/75]

DEFINE_TESTCASE ( expandmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [17/75]

DEFINE_TESTCASE ( boolquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [18/75]

DEFINE_TESTCASE ( msetfirst1  ,
backend   
)

◆ DEFINE_TESTCASE() [19/75]

DEFINE_TESTCASE ( topercent1  ,
backend   
)

◆ DEFINE_TESTCASE() [20/75]

DEFINE_TESTCASE ( topercent2  ,
backend   
)

◆ DEFINE_TESTCASE() [21/75]

DEFINE_TESTCASE ( expandfunctor1  ,
backend   
)

◆ DEFINE_TESTCASE() [22/75]

DEFINE_TESTCASE ( expanddeciderfilterprefix2  ,
backend   
)

◆ DEFINE_TESTCASE() [23/75]

DEFINE_TESTCASE ( pctcutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [24/75]

DEFINE_TESTCASE ( pctcutoff2  ,
backend   
)

◆ DEFINE_TESTCASE() [25/75]

DEFINE_TESTCASE ( pctcutoff3  ,
backend   
)

◆ DEFINE_TESTCASE() [26/75]

DEFINE_TESTCASE ( cutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [27/75]

DEFINE_TESTCASE ( allowqterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [28/75]

DEFINE_TESTCASE ( maxattain1  ,
backend   
)

◆ DEFINE_TESTCASE() [29/75]

DEFINE_TESTCASE ( reversebool1  ,
backend   
)

◆ DEFINE_TESTCASE() [30/75]

DEFINE_TESTCASE ( reversebool2  ,
backend   
)

◆ DEFINE_TESTCASE() [31/75]

DEFINE_TESTCASE ( getmterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [32/75]

DEFINE_TESTCASE ( getmterms2  ,
backend   
)

◆ DEFINE_TESTCASE() [33/75]

DEFINE_TESTCASE ( repeatquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [34/75]

DEFINE_TESTCASE ( fetchdocs1  ,
backend   
)

◆ DEFINE_TESTCASE() [35/75]

DEFINE_TESTCASE ( absentterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [36/75]

DEFINE_TESTCASE ( absentterm2  ,
backend   
)

◆ DEFINE_TESTCASE() [37/75]

DEFINE_TESTCASE ( rset1  ,
backend   
)

◆ DEFINE_TESTCASE() [38/75]

DEFINE_TESTCASE ( rset2  ,
backend   
)

◆ DEFINE_TESTCASE() [39/75]

DEFINE_TESTCASE ( rsetmultidb1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [40/75]

DEFINE_TESTCASE ( rsetmultidb3  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [41/75]

DEFINE_TESTCASE ( eliteset1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [42/75]

DEFINE_TESTCASE ( elitesetmulti1  ,
multi   
)

◆ DEFINE_TESTCASE() [43/75]

DEFINE_TESTCASE ( eliteset2  ,
backend &&!  multi 
)

Test that the elite set operator works if the set contains sub-expressions (regression test)

Definition at line 1219 of file api_anydb.cc.

References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_AND, Xapian::Query::OP_ELITE_SET, query(), Xapian::Enquire::set_query(), and TEST_EQUAL.

◆ DEFINE_TESTCASE() [44/75]

DEFINE_TESTCASE ( elitesetmulti2  ,
multi   
)

◆ DEFINE_TESTCASE() [45/75]

DEFINE_TESTCASE ( eliteset3  ,
backend   
)

Test that elite set doesn't affect query results if we have fewer terms than the threshold.

Definition at line 1277 of file api_anydb.cc.

References get_database(), Xapian::Enquire::get_mset(), Xapian::MSet::get_termfreq(), Xapian::MSet::get_termweight(), Xapian::Query::OP_ELITE_SET, Xapian::Query::OP_OR, Xapian::Enquire::set_query(), stemmer, and TEST_EQUAL.

◆ DEFINE_TESTCASE() [46/75]

DEFINE_TESTCASE ( eliteset4  ,
backend &&!  multi 
)

Test that elite set doesn't pick terms with 0 frequency.

Definition at line 1323 of file api_anydb.cc.

References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_ELITE_SET, query(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and TEST_NOT_EQUAL.

◆ DEFINE_TESTCASE() [47/75]

DEFINE_TESTCASE ( elitesetmulti4  ,
multi   
)

◆ DEFINE_TESTCASE() [48/75]

DEFINE_TESTCASE ( eliteset5  ,
backend   
)

Regression test for problem with excess precision.

Definition at line 1374 of file api_anydb.cc.

References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_ELITE_SET, Xapian::Query::OP_SCALE_WEIGHT, and Xapian::Enquire::set_query().

◆ DEFINE_TESTCASE() [49/75]

DEFINE_TESTCASE ( termlisttermfreq1  ,
backend   
)

◆ DEFINE_TESTCASE() [50/75]

DEFINE_TESTCASE ( qterminfo1  ,
backend   
)

◆ DEFINE_TESTCASE() [51/75]

DEFINE_TESTCASE ( qterminfo2  ,
backend   
)

◆ DEFINE_TESTCASE() [52/75]

DEFINE_TESTCASE ( msetzeroitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [53/75]

DEFINE_TESTCASE ( matches1  ,
backend   
)

◆ DEFINE_TESTCASE() [54/75]

DEFINE_TESTCASE ( wqf1  ,
backend   
)

◆ DEFINE_TESTCASE() [55/75]

DEFINE_TESTCASE ( qlen1  ,
backend   
)

◆ DEFINE_TESTCASE() [56/75]

DEFINE_TESTCASE ( termlist1  ,
backend   
)

Definition at line 1699 of file api_anydb.cc.

References get_database(), Xapian::Database::termlist_begin(), and TEST_EXCEPTION.

◆ DEFINE_TESTCASE() [57/75]

DEFINE_TESTCASE ( termlist2  ,
backend   
)

◆ DEFINE_TESTCASE() [58/75]

DEFINE_TESTCASE ( termlist3  ,
backend   
)

◆ DEFINE_TESTCASE() [59/75]

DEFINE_TESTCASE ( termlist4  ,
backend   
)

◆ DEFINE_TESTCASE() [60/75]

DEFINE_TESTCASE ( puncterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [61/75]

DEFINE_TESTCASE ( spaceterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [62/75]

DEFINE_TESTCASE ( xor1  ,
backend   
)

◆ DEFINE_TESTCASE() [63/75]

DEFINE_TESTCASE ( xor2  ,
backend   
)

Test that weighted XOR queries work (bug fixed in 1.2.1 and 1.0.21).

Definition at line 1856 of file api_anydb.cc.

References get_database(), Xapian::Enquire::get_mset(), mset_expect_order(), Xapian::Query::OP_XOR, query(), Xapian::Enquire::set_query(), and stemmer.

◆ DEFINE_TESTCASE() [64/75]

DEFINE_TESTCASE ( getdoc1  ,
backend   
)

◆ DEFINE_TESTCASE() [65/75]

DEFINE_TESTCASE ( emptyop1  ,
backend   
)

◆ DEFINE_TESTCASE() [66/75]

DEFINE_TESTCASE ( checkatleast1  ,
backend   
)

◆ DEFINE_TESTCASE() [67/75]

DEFINE_TESTCASE ( checkatleast2  ,
backend   
)

◆ DEFINE_TESTCASE() [68/75]

DEFINE_TESTCASE ( checkatleast3  ,
backend   
)

◆ DEFINE_TESTCASE() [69/75]

DEFINE_TESTCASE ( allpostlist1  ,
backend   
)

◆ DEFINE_TESTCASE() [70/75]

DEFINE_TESTCASE ( emptyterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [71/75]

DEFINE_TESTCASE ( alldocspl1  ,
backend   
)

◆ DEFINE_TESTCASE() [72/75]

DEFINE_TESTCASE ( alldocspl2  ,
writable   
)

◆ DEFINE_TESTCASE() [73/75]

DEFINE_TESTCASE ( scaleweight1  ,
backend   
)

◆ DEFINE_TESTCASE() [74/75]

DEFINE_TESTCASE ( scaleweight2  ,
backend   
)

◆ DEFINE_TESTCASE() [75/75]

DEFINE_TESTCASE ( uuid1  ,
backend &&!  multi 
)

◆ print_mset_percentages()

static void print_mset_percentages ( const Xapian::MSet mset)
static

◆ print_mset_weights()

static void print_mset_weights ( const Xapian::MSet mset)
static

◆ query() [1/3]

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() 
)
static

◆ query() [2/3]

static Xapian::Query query ( Xapian::Query::op  op,
Xapian::termcount  parameter,
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() 
)
static

Definition at line 86 of file api_anydb.cc.

References stemmer.

◆ query() [3/3]

static Xapian::Query query ( const string &  t)
static

Definition at line 109 of file api_anydb.cc.

◆ test_emptyterm1_helper()

static void test_emptyterm1_helper ( Xapian::Database db)
static

◆ test_termlist3_helper()

static Xapian::TermIterator test_termlist3_helper ( )
static

Definition at line 1740 of file api_anydb.cc.

References get_database(), and Xapian::Database::termlist_begin().

Referenced by DEFINE_TESTCASE().