xapian-core  1.4.20
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 (multidb3, backend &&!multi)
 
 DEFINE_TESTCASE (multidb4, backend &&!multi)
 
 DEFINE_TESTCASE (multidb5, 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)
 
 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, writable)
 
 DEFINE_TESTCASE (alldocspl2, writable)
 
 DEFINE_TESTCASE (scaleweight1, backend)
 
 DEFINE_TESTCASE (scaleweight2, backend)
 
 DEFINE_TESTCASE (bm25weight1, backend)
 
 DEFINE_TESTCASE (tradweight1, backend)
 
 DEFINE_TESTCASE (tradweight4, 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/80]

DEFINE_TESTCASE ( zerodocid1  ,
backend   
)

◆ DEFINE_TESTCASE() [2/80]

DEFINE_TESTCASE ( emptyquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [3/80]

DEFINE_TESTCASE ( simplequery1  ,
backend   
)

◆ DEFINE_TESTCASE() [4/80]

DEFINE_TESTCASE ( simplequery2  ,
backend   
)

◆ DEFINE_TESTCASE() [5/80]

DEFINE_TESTCASE ( simplequery3  ,
backend   
)

◆ DEFINE_TESTCASE() [6/80]

DEFINE_TESTCASE ( multidb3  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [7/80]

DEFINE_TESTCASE ( multidb4  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [8/80]

DEFINE_TESTCASE ( multidb5  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [9/80]

DEFINE_TESTCASE ( msetmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [10/80]

DEFINE_TESTCASE ( expandweights1  ,
backend   
)

◆ DEFINE_TESTCASE() [11/80]

DEFINE_TESTCASE ( expandweights2  ,
backend   
)

◆ DEFINE_TESTCASE() [12/80]

DEFINE_TESTCASE ( expandweights3  ,
backend   
)

◆ DEFINE_TESTCASE() [13/80]

DEFINE_TESTCASE ( expandweights4  ,
backend   
)

◆ DEFINE_TESTCASE() [14/80]

DEFINE_TESTCASE ( expandweights5  ,
backend   
)

◆ DEFINE_TESTCASE() [15/80]

DEFINE_TESTCASE ( expandweights6  ,
backend   
)

◆ DEFINE_TESTCASE() [16/80]

DEFINE_TESTCASE ( expandweights7  ,
backend   
)

◆ DEFINE_TESTCASE() [17/80]

DEFINE_TESTCASE ( expandweights8  ,
backend   
)

◆ DEFINE_TESTCASE() [18/80]

DEFINE_TESTCASE ( expandmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [19/80]

DEFINE_TESTCASE ( boolquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [20/80]

DEFINE_TESTCASE ( msetfirst1  ,
backend   
)

◆ DEFINE_TESTCASE() [21/80]

DEFINE_TESTCASE ( topercent1  ,
backend   
)

◆ DEFINE_TESTCASE() [22/80]

DEFINE_TESTCASE ( topercent2  ,
backend   
)

◆ DEFINE_TESTCASE() [23/80]

DEFINE_TESTCASE ( expandfunctor1  ,
backend   
)

◆ DEFINE_TESTCASE() [24/80]

DEFINE_TESTCASE ( expanddeciderfilterprefix2  ,
backend   
)

◆ DEFINE_TESTCASE() [25/80]

DEFINE_TESTCASE ( pctcutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [26/80]

DEFINE_TESTCASE ( pctcutoff2  ,
backend   
)

◆ DEFINE_TESTCASE() [27/80]

DEFINE_TESTCASE ( pctcutoff3  ,
backend   
)

◆ DEFINE_TESTCASE() [28/80]

DEFINE_TESTCASE ( cutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [29/80]

DEFINE_TESTCASE ( allowqterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [30/80]

DEFINE_TESTCASE ( maxattain1  ,
backend   
)

◆ DEFINE_TESTCASE() [31/80]

DEFINE_TESTCASE ( reversebool1  ,
backend   
)

◆ DEFINE_TESTCASE() [32/80]

DEFINE_TESTCASE ( reversebool2  ,
backend   
)

◆ DEFINE_TESTCASE() [33/80]

DEFINE_TESTCASE ( getmterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [34/80]

DEFINE_TESTCASE ( getmterms2  ,
backend   
)

◆ DEFINE_TESTCASE() [35/80]

DEFINE_TESTCASE ( repeatquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [36/80]

DEFINE_TESTCASE ( fetchdocs1  ,
backend   
)

◆ DEFINE_TESTCASE() [37/80]

DEFINE_TESTCASE ( absentterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [38/80]

DEFINE_TESTCASE ( absentterm2  ,
backend   
)

◆ DEFINE_TESTCASE() [39/80]

DEFINE_TESTCASE ( rset1  ,
backend   
)

◆ DEFINE_TESTCASE() [40/80]

DEFINE_TESTCASE ( rset2  ,
backend   
)

◆ DEFINE_TESTCASE() [41/80]

DEFINE_TESTCASE ( rsetmultidb1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [42/80]

DEFINE_TESTCASE ( rsetmultidb3  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [43/80]

DEFINE_TESTCASE ( eliteset1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [44/80]

DEFINE_TESTCASE ( elitesetmulti1  ,
multi   
)

◆ DEFINE_TESTCASE() [45/80]

DEFINE_TESTCASE ( eliteset2  ,
backend &&!  multi 
)

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

Definition at line 1236 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() [46/80]

DEFINE_TESTCASE ( elitesetmulti2  ,
multi   
)

◆ DEFINE_TESTCASE() [47/80]

DEFINE_TESTCASE ( eliteset3  ,
backend   
)

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

Definition at line 1294 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() [48/80]

DEFINE_TESTCASE ( eliteset4  ,
backend &&!  multi 
)

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

Definition at line 1340 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() [49/80]

DEFINE_TESTCASE ( elitesetmulti4  ,
multi   
)

◆ DEFINE_TESTCASE() [50/80]

DEFINE_TESTCASE ( eliteset5  ,
backend   
)

Regression test for problem with excess precision.

Definition at line 1391 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() [51/80]

DEFINE_TESTCASE ( termlisttermfreq1  ,
backend   
)

◆ DEFINE_TESTCASE() [52/80]

DEFINE_TESTCASE ( qterminfo1  ,
backend   
)

◆ DEFINE_TESTCASE() [53/80]

DEFINE_TESTCASE ( qterminfo2  ,
backend   
)

◆ DEFINE_TESTCASE() [54/80]

DEFINE_TESTCASE ( msetzeroitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [55/80]

DEFINE_TESTCASE ( matches1  ,
backend   
)

◆ DEFINE_TESTCASE() [56/80]

DEFINE_TESTCASE ( wqf1  ,
backend   
)

◆ DEFINE_TESTCASE() [57/80]

DEFINE_TESTCASE ( qlen1  ,
backend   
)

◆ DEFINE_TESTCASE() [58/80]

DEFINE_TESTCASE ( termlist1  ,
backend   
)

Definition at line 1709 of file api_anydb.cc.

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

◆ DEFINE_TESTCASE() [59/80]

DEFINE_TESTCASE ( termlist2  ,
backend   
)

◆ DEFINE_TESTCASE() [60/80]

DEFINE_TESTCASE ( termlist3  ,
backend   
)

◆ DEFINE_TESTCASE() [61/80]

DEFINE_TESTCASE ( termlist4  ,
backend   
)

◆ DEFINE_TESTCASE() [62/80]

DEFINE_TESTCASE ( puncterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [63/80]

DEFINE_TESTCASE ( spaceterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [64/80]

DEFINE_TESTCASE ( xor1  ,
backend   
)

◆ DEFINE_TESTCASE() [65/80]

DEFINE_TESTCASE ( xor2  ,
backend   
)

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

Definition at line 1866 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() [66/80]

DEFINE_TESTCASE ( getdoc1  ,
backend   
)

◆ DEFINE_TESTCASE() [67/80]

DEFINE_TESTCASE ( emptyop1  ,
backend   
)

◆ DEFINE_TESTCASE() [68/80]

DEFINE_TESTCASE ( checkatleast1  ,
backend   
)

◆ DEFINE_TESTCASE() [69/80]

DEFINE_TESTCASE ( checkatleast2  ,
backend   
)

◆ DEFINE_TESTCASE() [70/80]

DEFINE_TESTCASE ( checkatleast3  ,
backend   
)

◆ DEFINE_TESTCASE() [71/80]

DEFINE_TESTCASE ( allpostlist1  ,
backend   
)

◆ DEFINE_TESTCASE() [72/80]

DEFINE_TESTCASE ( emptyterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [73/80]

DEFINE_TESTCASE ( alldocspl1  ,
writable   
)

◆ DEFINE_TESTCASE() [74/80]

DEFINE_TESTCASE ( alldocspl2  ,
writable   
)

◆ DEFINE_TESTCASE() [75/80]

DEFINE_TESTCASE ( scaleweight1  ,
backend   
)

◆ DEFINE_TESTCASE() [76/80]

DEFINE_TESTCASE ( scaleweight2  ,
backend   
)

◆ DEFINE_TESTCASE() [77/80]

DEFINE_TESTCASE ( bm25weight1  ,
backend   
)

◆ DEFINE_TESTCASE() [78/80]

DEFINE_TESTCASE ( tradweight1  ,
backend   
)

◆ DEFINE_TESTCASE() [79/80]

DEFINE_TESTCASE ( tradweight4  ,
backend   
)

◆ DEFINE_TESTCASE() [80/80]

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 1750 of file api_anydb.cc.

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

Referenced by DEFINE_TESTCASE().