xapian-core  1.4.27
Classes | Typedefs | Functions
soaktest_queries.cc File Reference

Soaktest generating lots of random queries. More...

#include <config.h>
#include "soaktest/soaktest.h"
#include "soaktest/soaktest_queries.h"
#include <xapian.h>
#include "backendmanager.h"
#include "str.h"
#include "testrunner.h"
#include "testsuite.h"
#include "testutils.h"
#include <list>
+ Include dependency graph for soaktest_queries.cc:

Go to the source code of this file.

Classes

struct  QueryBuilderEnv
 The environment used by the steps when building a query. More...
 
class  QueryBuilder
 Random query builder. More...
 

Typedefs

typedef void(* QueryStep) (QueryBuilderEnv &)
 

Functions

static void builddb_queries1 (Xapian::WritableDatabase &db, const string &arg)
 Make a database in which docs have the fields: More...
 
static void push_leaf_N (QueryBuilderEnv &env)
 Push a leaf query on field N onto the list of query pieces. More...
 
static void combine_OR (QueryBuilderEnv &env)
 Combine some queries with OR. More...
 
static void combine_AND (QueryBuilderEnv &env)
 Combine some queries with AND. More...
 
static void combine_XOR (QueryBuilderEnv &env)
 Combine some queries with XOR. More...
 
static void combine_NOT (QueryBuilderEnv &env)
 Combine some queries with AND_NOT. More...
 
 DEFINE_TESTCASE (queries1, writable &&!remote &&!inmemory)
 

Detailed Description

Soaktest generating lots of random queries.

Definition in file soaktest_queries.cc.

Typedef Documentation

◆ QueryStep

typedef void(* QueryStep) (QueryBuilderEnv &)

Definition at line 90 of file soaktest_queries.cc.

Function Documentation

◆ builddb_queries1()

static void builddb_queries1 ( Xapian::WritableDatabase db,
const string &  arg 
)
static

Make a database in which docs have the fields:

  • N: values are numbers between 1 and maxtermsperfield. Each document contains all Nx for x from 1 to randint(maxtermsperfield).

Definition at line 46 of file soaktest_queries.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), randint(), and Xapian::Internal::str().

Referenced by DEFINE_TESTCASE().

◆ combine_AND()

static void combine_AND ( QueryBuilderEnv env)
static

Combine some queries with AND.

The queries are removed from the list and the combined query is added to the end.

Definition at line 117 of file soaktest_queries.cc.

References QueryBuilderEnv::maxchildren, Xapian::Query::OP_AND, QueryBuilderEnv::pick(), QueryBuilderEnv::pieces, and randint().

Referenced by QueryBuilder::QueryBuilder().

◆ combine_NOT()

static void combine_NOT ( QueryBuilderEnv env)
static

Combine some queries with AND_NOT.

The queries are removed from the list and the combined query is added to the end.

Definition at line 143 of file soaktest_queries.cc.

References Xapian::Query::OP_AND_NOT, QueryBuilderEnv::pick(), and QueryBuilderEnv::pieces.

Referenced by QueryBuilder::QueryBuilder().

◆ combine_OR()

static void combine_OR ( QueryBuilderEnv env)
static

Combine some queries with OR.

The queries are removed from the list and the combined query is added to the end.

Definition at line 104 of file soaktest_queries.cc.

References QueryBuilderEnv::maxchildren, Xapian::Query::OP_OR, QueryBuilderEnv::pick(), QueryBuilderEnv::pieces, and randint().

Referenced by QueryBuilder::QueryBuilder().

◆ combine_XOR()

static void combine_XOR ( QueryBuilderEnv env)
static

Combine some queries with XOR.

The queries are removed from the list and the combined query is added to the end.

Definition at line 130 of file soaktest_queries.cc.

References QueryBuilderEnv::maxchildren, Xapian::Query::OP_XOR, QueryBuilderEnv::pick(), QueryBuilderEnv::pieces, and randint().

Referenced by QueryBuilder::QueryBuilder().

◆ DEFINE_TESTCASE()

DEFINE_TESTCASE ( queries1  ,
writable &&!remote &&!  inmemory 
)

◆ push_leaf_N()

static void push_leaf_N ( QueryBuilderEnv env)
static

Push a leaf query on field N onto the list of query pieces.

Definition at line 93 of file soaktest_queries.cc.

References QueryBuilderEnv::maxtermsperfield, QueryBuilderEnv::pieces, randint(), and Xapian::Internal::str().

Referenced by QueryBuilder::QueryBuilder().