xapian-core  1.4.25
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)
 
 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 (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/78]

DEFINE_TESTCASE ( zerodocid1  ,
backend   
)

◆ DEFINE_TESTCASE() [2/78]

DEFINE_TESTCASE ( emptyquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [3/78]

DEFINE_TESTCASE ( simplequery1  ,
backend   
)

◆ DEFINE_TESTCASE() [4/78]

DEFINE_TESTCASE ( simplequery2  ,
backend   
)

◆ DEFINE_TESTCASE() [5/78]

DEFINE_TESTCASE ( simplequery3  ,
backend   
)

◆ DEFINE_TESTCASE() [6/78]

DEFINE_TESTCASE ( multidb2  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [7/78]

DEFINE_TESTCASE ( msetmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [8/78]

DEFINE_TESTCASE ( expandweights1  ,
backend   
)

◆ DEFINE_TESTCASE() [9/78]

DEFINE_TESTCASE ( expandweights2  ,
backend   
)

◆ DEFINE_TESTCASE() [10/78]

DEFINE_TESTCASE ( expandweights3  ,
backend   
)

◆ DEFINE_TESTCASE() [11/78]

DEFINE_TESTCASE ( expandweights4  ,
backend   
)

◆ DEFINE_TESTCASE() [12/78]

DEFINE_TESTCASE ( expandweights5  ,
backend   
)

◆ DEFINE_TESTCASE() [13/78]

DEFINE_TESTCASE ( expandweights6  ,
backend   
)

◆ DEFINE_TESTCASE() [14/78]

DEFINE_TESTCASE ( expandweights7  ,
backend   
)

◆ DEFINE_TESTCASE() [15/78]

DEFINE_TESTCASE ( expandweights8  ,
backend   
)

◆ DEFINE_TESTCASE() [16/78]

DEFINE_TESTCASE ( expandmaxitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [17/78]

DEFINE_TESTCASE ( boolquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [18/78]

DEFINE_TESTCASE ( msetfirst1  ,
backend   
)

◆ DEFINE_TESTCASE() [19/78]

DEFINE_TESTCASE ( topercent1  ,
backend   
)

◆ DEFINE_TESTCASE() [20/78]

DEFINE_TESTCASE ( topercent2  ,
backend   
)

◆ DEFINE_TESTCASE() [21/78]

DEFINE_TESTCASE ( expandfunctor1  ,
backend   
)

◆ DEFINE_TESTCASE() [22/78]

DEFINE_TESTCASE ( expanddeciderfilterprefix2  ,
backend   
)

◆ DEFINE_TESTCASE() [23/78]

DEFINE_TESTCASE ( pctcutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [24/78]

DEFINE_TESTCASE ( pctcutoff2  ,
backend   
)

◆ DEFINE_TESTCASE() [25/78]

DEFINE_TESTCASE ( pctcutoff3  ,
backend   
)

◆ DEFINE_TESTCASE() [26/78]

DEFINE_TESTCASE ( cutoff1  ,
backend   
)

◆ DEFINE_TESTCASE() [27/78]

DEFINE_TESTCASE ( allowqterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [28/78]

DEFINE_TESTCASE ( maxattain1  ,
backend   
)

◆ DEFINE_TESTCASE() [29/78]

DEFINE_TESTCASE ( reversebool1  ,
backend   
)

◆ DEFINE_TESTCASE() [30/78]

DEFINE_TESTCASE ( reversebool2  ,
backend   
)

◆ DEFINE_TESTCASE() [31/78]

DEFINE_TESTCASE ( getmterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [32/78]

DEFINE_TESTCASE ( getmterms2  ,
backend   
)

◆ DEFINE_TESTCASE() [33/78]

DEFINE_TESTCASE ( repeatquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [34/78]

DEFINE_TESTCASE ( fetchdocs1  ,
backend   
)

◆ DEFINE_TESTCASE() [35/78]

DEFINE_TESTCASE ( absentterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [36/78]

DEFINE_TESTCASE ( absentterm2  ,
backend   
)

◆ DEFINE_TESTCASE() [37/78]

DEFINE_TESTCASE ( rset1  ,
backend   
)

◆ DEFINE_TESTCASE() [38/78]

DEFINE_TESTCASE ( rset2  ,
backend   
)

◆ DEFINE_TESTCASE() [39/78]

DEFINE_TESTCASE ( rsetmultidb1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [40/78]

DEFINE_TESTCASE ( rsetmultidb3  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [41/78]

DEFINE_TESTCASE ( eliteset1  ,
backend &&!  multi 
)

◆ DEFINE_TESTCASE() [42/78]

DEFINE_TESTCASE ( elitesetmulti1  ,
multi   
)

◆ DEFINE_TESTCASE() [43/78]

DEFINE_TESTCASE ( eliteset2  ,
backend &&!  multi 
)

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

Definition at line 1202 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/78]

DEFINE_TESTCASE ( elitesetmulti2  ,
multi   
)

◆ DEFINE_TESTCASE() [45/78]

DEFINE_TESTCASE ( eliteset3  ,
backend   
)

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

Definition at line 1260 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/78]

DEFINE_TESTCASE ( eliteset4  ,
backend &&!  multi 
)

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

Definition at line 1306 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/78]

DEFINE_TESTCASE ( elitesetmulti4  ,
multi   
)

◆ DEFINE_TESTCASE() [48/78]

DEFINE_TESTCASE ( eliteset5  ,
backend   
)

Regression test for problem with excess precision.

Definition at line 1357 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/78]

DEFINE_TESTCASE ( termlisttermfreq1  ,
backend   
)

◆ DEFINE_TESTCASE() [50/78]

DEFINE_TESTCASE ( qterminfo1  ,
backend   
)

◆ DEFINE_TESTCASE() [51/78]

DEFINE_TESTCASE ( qterminfo2  ,
backend   
)

◆ DEFINE_TESTCASE() [52/78]

DEFINE_TESTCASE ( msetzeroitems1  ,
backend   
)

◆ DEFINE_TESTCASE() [53/78]

DEFINE_TESTCASE ( matches1  ,
backend   
)

◆ DEFINE_TESTCASE() [54/78]

DEFINE_TESTCASE ( wqf1  ,
backend   
)

◆ DEFINE_TESTCASE() [55/78]

DEFINE_TESTCASE ( qlen1  ,
backend   
)

◆ DEFINE_TESTCASE() [56/78]

DEFINE_TESTCASE ( termlist1  ,
backend   
)

Definition at line 1675 of file api_anydb.cc.

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

◆ DEFINE_TESTCASE() [57/78]

DEFINE_TESTCASE ( termlist2  ,
backend   
)

◆ DEFINE_TESTCASE() [58/78]

DEFINE_TESTCASE ( termlist3  ,
backend   
)

◆ DEFINE_TESTCASE() [59/78]

DEFINE_TESTCASE ( termlist4  ,
backend   
)

◆ DEFINE_TESTCASE() [60/78]

DEFINE_TESTCASE ( puncterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [61/78]

DEFINE_TESTCASE ( spaceterms1  ,
backend   
)

◆ DEFINE_TESTCASE() [62/78]

DEFINE_TESTCASE ( xor1  ,
backend   
)

◆ DEFINE_TESTCASE() [63/78]

DEFINE_TESTCASE ( xor2  ,
backend   
)

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

Definition at line 1832 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/78]

DEFINE_TESTCASE ( getdoc1  ,
backend   
)

◆ DEFINE_TESTCASE() [65/78]

DEFINE_TESTCASE ( emptyop1  ,
backend   
)

◆ DEFINE_TESTCASE() [66/78]

DEFINE_TESTCASE ( checkatleast1  ,
backend   
)

◆ DEFINE_TESTCASE() [67/78]

DEFINE_TESTCASE ( checkatleast2  ,
backend   
)

◆ DEFINE_TESTCASE() [68/78]

DEFINE_TESTCASE ( checkatleast3  ,
backend   
)

◆ DEFINE_TESTCASE() [69/78]

DEFINE_TESTCASE ( allpostlist1  ,
backend   
)

◆ DEFINE_TESTCASE() [70/78]

DEFINE_TESTCASE ( emptyterm1  ,
backend   
)

◆ DEFINE_TESTCASE() [71/78]

DEFINE_TESTCASE ( alldocspl1  ,
backend   
)

◆ DEFINE_TESTCASE() [72/78]

DEFINE_TESTCASE ( alldocspl2  ,
writable   
)

◆ DEFINE_TESTCASE() [73/78]

DEFINE_TESTCASE ( scaleweight1  ,
backend   
)

◆ DEFINE_TESTCASE() [74/78]

DEFINE_TESTCASE ( scaleweight2  ,
backend   
)

◆ DEFINE_TESTCASE() [75/78]

DEFINE_TESTCASE ( bm25weight1  ,
backend   
)

◆ DEFINE_TESTCASE() [76/78]

DEFINE_TESTCASE ( tradweight1  ,
backend   
)

◆ DEFINE_TESTCASE() [77/78]

DEFINE_TESTCASE ( tradweight4  ,
backend   
)

◆ DEFINE_TESTCASE() [78/78]

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

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

Referenced by DEFINE_TESTCASE().