xapian-core  1.4.27
Classes | Macros | Functions | Variables
api_queryparser.cc File Reference

Tests of Xapian::QueryParser. More...

#include <config.h>
#include "api_queryparser.h"
#include <xapian.h>
#include "apitest.h"
#include "cputimer.h"
#include "str.h"
#include "stringutils.h"
#include <string>
#include <vector>
#include "testsuite.h"
#include "testutils.h"
+ Include dependency graph for api_queryparser.cc:

Go to the source code of this file.

Classes

struct  test
 
struct  AuthorValueRangeProcessor
 
struct  AuthorRangeProcessor
 
class  TitleFieldProcessor
 
class  HostFieldProcessor
 
class  DateRangeFieldProcessor
 
struct  qp_default_op3_test
 

Macros

#define XAPIAN_DEPRECATED(D)   D
 

Functions

 DEFINE_TESTCASE (queryparser1, !backend)
 
 DEFINE_TESTCASE (qp_default_op1, !backend)
 
 DEFINE_TESTCASE (qp_default_prefix1, !backend)
 
 DEFINE_TESTCASE (qp_default_prefix2, !backend)
 
 DEFINE_TESTCASE (qp_odd_chars1, !backend)
 
 DEFINE_TESTCASE (qp_flag_wildcard1, backend)
 
 DEFINE_TESTCASE (qp_flag_wildcard2, backend)
 
static void test_qp_flag_wildcard3_helper (const Xapian::Database &db, Xapian::termcount max_expansion, const string &query_string)
 
 DEFINE_TESTCASE (qp_flag_wildcard3, backend)
 
static void gen_qp_flag_partial1_db (Xapian::WritableDatabase &db, const string &)
 
 DEFINE_TESTCASE (qp_flag_partial1, backend)
 
 DEFINE_TESTCASE (wildquery1, backend)
 
 DEFINE_TESTCASE (qp_flag_bool_any_case1, !backend)
 
 DEFINE_TESTCASE (qp_stopper1, !backend)
 
 DEFINE_TESTCASE (qp_flag_pure_not1, !backend)
 
 DEFINE_TESTCASE (qp_unstem_boolean_prefix, !backend)
 
 DEFINE_TESTCASE (qp_accumulate, !backend)
 
 DEFINE_TESTCASE (qp_value_range1, !backend)
 
 DEFINE_TESTCASE (qp_range1, !backend)
 
 DEFINE_TESTCASE (qp_value_range2, !backend)
 
 DEFINE_TESTCASE (qp_range2, !backend)
 
static void gen_qp_range3_db (Xapian::WritableDatabase &db, const string &)
 
 DEFINE_TESTCASE (qp_value_range3, backend)
 
 DEFINE_TESTCASE (qp_range3, backend)
 
 DEFINE_TESTCASE (qp_value_range4, !backend)
 Test a boolean filter which happens to contain "..". More...
 
 DEFINE_TESTCASE (qp_range4, !backend)
 Test a boolean filter which happens to contain "..". More...
 
 DEFINE_TESTCASE (qp_value_daterange1, !backend)
 
 DEFINE_TESTCASE (qp_daterange1, !backend)
 
 DEFINE_TESTCASE (qp_value_daterange2, !backend)
 
 DEFINE_TESTCASE (qp_daterange2, !backend)
 
 DEFINE_TESTCASE (qp_value_stringrange1, !backend)
 
 DEFINE_TESTCASE (qp_stringrange1, !backend)
 
 DEFINE_TESTCASE (qp_value_customrange1, !backend)
 
 DEFINE_TESTCASE (qp_customrange1, !backend)
 
 DEFINE_TESTCASE (qp_fieldproc1, !backend)
 
 DEFINE_TESTCASE (qp_fieldproc2, !backend)
 
 DEFINE_TESTCASE (qp_fieldproc3, !backend)
 
 DEFINE_TESTCASE (qp_stoplist1, !backend)
 
 DEFINE_TESTCASE (qp_spell1, spelling)
 
 DEFINE_TESTCASE (qp_spell2, spelling)
 
static void gen_simple_spelling_db (Xapian::WritableDatabase &db, const string &)
 
 DEFINE_TESTCASE (qp_spellwild1, spelling)
 
 DEFINE_TESTCASE (qp_spellpartial1, spelling)
 
 DEFINE_TESTCASE (qp_synonym1, synonyms)
 
 DEFINE_TESTCASE (qp_synonym2, synonyms)
 
 DEFINE_TESTCASE (qp_synonym3, synonyms)
 
 DEFINE_TESTCASE (qp_stem_all1, !backend)
 
 DEFINE_TESTCASE (qp_stem_all_z1, !backend)
 
static double time_query_parse (const Xapian::Database &db, const string &q, int repetitions, unsigned flags)
 
static void qp_scale1_helper (const Xapian::Database &db, const string &q, unsigned n, unsigned flags)
 
 DEFINE_TESTCASE (qp_scale1, writable &&synonyms)
 
 DEFINE_TESTCASE (qp_near1, !backend)
 
 DEFINE_TESTCASE (qp_phrase1, !backend)
 
 DEFINE_TESTCASE (qp_stopword_group1, backend)
 
 DEFINE_TESTCASE (qp_default_op2, !backend)
 Check that QueryParser::set_default_op() rejects inappropriate ops. More...
 
 DEFINE_TESTCASE (qp_default_op3, !backend)
 Check that QueryParser::set_default_op() accepts appropriate ops. More...
 
 DEFINE_TESTCASE (qp_defaultstrategysome1, !backend)
 Test that the default strategy is now STEM_SOME (as of 1.3.1). More...
 
 DEFINE_TESTCASE (qp_stemsomefullpos, !backend)
 Test STEM_SOME_FULL_POS. More...
 
 DEFINE_TESTCASE (qp_nopos, !backend)
 

Variables

static const test test_or_queries []
 
static const test test_and_queries []
 
static const test test_stop_queries []
 
static const test test_pure_not_queries []
 
static const test test_value_range1_queries []
 
static const test test_value_range2_queries []
 
static const test test_value_range4_queries []
 
static const test test_value_daterange1_queries []
 
static const test test_value_daterange2_queries []
 
static const test test_value_stringrange1_queries []
 
static const test test_value_customrange1_queries []
 
static const test test_fieldproc1_queries []
 
static const test test_fieldproc2_queries []
 
static const test test_mispelled_queries []
 
static const test test_mispelled_wildcard_queries []
 
static const test test_mispelled_partial_queries []
 
static const test test_synonym_queries []
 
static const test test_multi_synonym_queries []
 
static const test test_synonym_op_queries []
 
static const test test_stem_all_queries []
 
static const test test_stem_all_z_queries []
 
static const test test_near_queries []
 
static const test test_phrase_queries []
 
static const test test_stopword_group_or_queries []
 
static const test test_stopword_group_and_queries []
 

Detailed Description

Tests of Xapian::QueryParser.

Definition in file api_queryparser.cc.

Macro Definition Documentation

◆ XAPIAN_DEPRECATED

#define XAPIAN_DEPRECATED (   D)    D

Definition at line 27 of file api_queryparser.cc.

Function Documentation

◆ DEFINE_TESTCASE() [1/53]

DEFINE_TESTCASE ( queryparser1  ,
backend 
)

◆ DEFINE_TESTCASE() [2/53]

DEFINE_TESTCASE ( qp_default_op1  ,
backend 
)

◆ DEFINE_TESTCASE() [3/53]

DEFINE_TESTCASE ( qp_default_prefix1  ,
backend 
)

◆ DEFINE_TESTCASE() [4/53]

DEFINE_TESTCASE ( qp_default_prefix2  ,
backend 
)

◆ DEFINE_TESTCASE() [5/53]

DEFINE_TESTCASE ( qp_odd_chars1  ,
backend 
)

◆ DEFINE_TESTCASE() [6/53]

DEFINE_TESTCASE ( qp_flag_wildcard1  ,
backend   
)

◆ DEFINE_TESTCASE() [7/53]

DEFINE_TESTCASE ( qp_flag_wildcard2  ,
backend   
)

◆ DEFINE_TESTCASE() [8/53]

DEFINE_TESTCASE ( qp_flag_wildcard3  ,
backend   
)

◆ DEFINE_TESTCASE() [9/53]

DEFINE_TESTCASE ( qp_flag_partial1  ,
backend   
)

◆ DEFINE_TESTCASE() [10/53]

DEFINE_TESTCASE ( wildquery1  ,
backend   
)

◆ DEFINE_TESTCASE() [11/53]

DEFINE_TESTCASE ( qp_flag_bool_any_case1  ,
backend 
)

◆ DEFINE_TESTCASE() [12/53]

DEFINE_TESTCASE ( qp_stopper1  ,
backend 
)

◆ DEFINE_TESTCASE() [13/53]

DEFINE_TESTCASE ( qp_flag_pure_not1  ,
backend 
)

◆ DEFINE_TESTCASE() [14/53]

DEFINE_TESTCASE ( qp_unstem_boolean_prefix  ,
backend 
)

◆ DEFINE_TESTCASE() [15/53]

DEFINE_TESTCASE ( qp_accumulate  ,
backend 
)

◆ DEFINE_TESTCASE() [16/53]

DEFINE_TESTCASE ( qp_value_range1  ,
backend 
)

◆ DEFINE_TESTCASE() [17/53]

DEFINE_TESTCASE ( qp_range1  ,
backend 
)

◆ DEFINE_TESTCASE() [18/53]

DEFINE_TESTCASE ( qp_value_range2  ,
backend 
)

◆ DEFINE_TESTCASE() [19/53]

DEFINE_TESTCASE ( qp_range2  ,
backend 
)

◆ DEFINE_TESTCASE() [20/53]

DEFINE_TESTCASE ( qp_value_range3  ,
backend   
)

◆ DEFINE_TESTCASE() [21/53]

DEFINE_TESTCASE ( qp_range3  ,
backend   
)

◆ DEFINE_TESTCASE() [22/53]

DEFINE_TESTCASE ( qp_value_range4  ,
backend 
)

Test a boolean filter which happens to contain "..".

Regression test for bug fixed in 1.2.3.

Also test that the same prefix can be set for a valuerange and filter.

Definition at line 1785 of file api_queryparser.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::QueryParser::add_valuerangeprocessor(), Xapian::Error::get_description(), Xapian::Query::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), TEST_STRINGS_EQUAL, and tout.

◆ DEFINE_TESTCASE() [23/53]

DEFINE_TESTCASE ( qp_range4  ,
backend 
)

Test a boolean filter which happens to contain "..".

Regression test for bug fixed in 1.2.3.

Also test that the same prefix can be set for a range and filter.

Definition at line 1819 of file api_queryparser.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::QueryParser::add_rangeprocessor(), Xapian::Error::get_description(), Xapian::Query::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), TEST_STRINGS_EQUAL, and tout.

◆ DEFINE_TESTCASE() [24/53]

DEFINE_TESTCASE ( qp_value_daterange1  ,
backend 
)

◆ DEFINE_TESTCASE() [25/53]

DEFINE_TESTCASE ( qp_daterange1  ,
backend 
)

◆ DEFINE_TESTCASE() [26/53]

DEFINE_TESTCASE ( qp_value_daterange2  ,
backend 
)

◆ DEFINE_TESTCASE() [27/53]

DEFINE_TESTCASE ( qp_daterange2  ,
backend 
)

◆ DEFINE_TESTCASE() [28/53]

DEFINE_TESTCASE ( qp_value_stringrange1  ,
backend 
)

◆ DEFINE_TESTCASE() [29/53]

DEFINE_TESTCASE ( qp_stringrange1  ,
backend 
)

◆ DEFINE_TESTCASE() [30/53]

DEFINE_TESTCASE ( qp_value_customrange1  ,
backend 
)

◆ DEFINE_TESTCASE() [31/53]

DEFINE_TESTCASE ( qp_customrange1  ,
backend 
)

◆ DEFINE_TESTCASE() [32/53]

DEFINE_TESTCASE ( qp_fieldproc1  ,
backend 
)

◆ DEFINE_TESTCASE() [33/53]

DEFINE_TESTCASE ( qp_fieldproc2  ,
backend 
)

◆ DEFINE_TESTCASE() [34/53]

DEFINE_TESTCASE ( qp_fieldproc3  ,
backend 
)

◆ DEFINE_TESTCASE() [35/53]

DEFINE_TESTCASE ( qp_stoplist1  ,
backend 
)

◆ DEFINE_TESTCASE() [36/53]

DEFINE_TESTCASE ( qp_spell1  ,
spelling   
)

◆ DEFINE_TESTCASE() [37/53]

DEFINE_TESTCASE ( qp_spell2  ,
spelling   
)

◆ DEFINE_TESTCASE() [38/53]

DEFINE_TESTCASE ( qp_spellwild1  ,
spelling   
)

◆ DEFINE_TESTCASE() [39/53]

DEFINE_TESTCASE ( qp_spellpartial1  ,
spelling   
)

◆ DEFINE_TESTCASE() [40/53]

DEFINE_TESTCASE ( qp_synonym1  ,
synonyms   
)

◆ DEFINE_TESTCASE() [41/53]

DEFINE_TESTCASE ( qp_synonym2  ,
synonyms   
)

◆ DEFINE_TESTCASE() [42/53]

DEFINE_TESTCASE ( qp_synonym3  ,
synonyms   
)

◆ DEFINE_TESTCASE() [43/53]

DEFINE_TESTCASE ( qp_stem_all1  ,
backend 
)

◆ DEFINE_TESTCASE() [44/53]

DEFINE_TESTCASE ( qp_stem_all_z1  ,
backend 
)

◆ DEFINE_TESTCASE() [45/53]

DEFINE_TESTCASE ( qp_scale1  ,
writable &&  synonyms 
)

◆ DEFINE_TESTCASE() [46/53]

DEFINE_TESTCASE ( qp_near1  ,
backend 
)

◆ DEFINE_TESTCASE() [47/53]

DEFINE_TESTCASE ( qp_phrase1  ,
backend 
)

◆ DEFINE_TESTCASE() [48/53]

DEFINE_TESTCASE ( qp_stopword_group1  ,
backend   
)

◆ DEFINE_TESTCASE() [49/53]

DEFINE_TESTCASE ( qp_default_op2  ,
backend 
)

◆ DEFINE_TESTCASE() [50/53]

DEFINE_TESTCASE ( qp_default_op3  ,
backend 
)

◆ DEFINE_TESTCASE() [51/53]

DEFINE_TESTCASE ( qp_defaultstrategysome1  ,
backend 
)

Test that the default strategy is now STEM_SOME (as of 1.3.1).

Definition at line 3059 of file api_queryparser.cc.

References Xapian::Query::get_description(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_stemmer(), and TEST_EQUAL.

◆ DEFINE_TESTCASE() [52/53]

DEFINE_TESTCASE ( qp_stemsomefullpos  ,
backend 
)

◆ DEFINE_TESTCASE() [53/53]

DEFINE_TESTCASE ( qp_nopos  ,
backend 
)

◆ gen_qp_flag_partial1_db()

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

◆ gen_qp_range3_db()

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

◆ gen_simple_spelling_db()

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

Definition at line 2404 of file api_queryparser.cc.

References Xapian::WritableDatabase::add_spelling().

Referenced by DEFINE_TESTCASE().

◆ qp_scale1_helper()

static void qp_scale1_helper ( const Xapian::Database db,
const string &  q,
unsigned  n,
unsigned  flags 
)
static

Definition at line 2709 of file api_queryparser.cc.

References SKIP_TEST, TEST_REL, time_query_parse(), and tout.

Referenced by DEFINE_TESTCASE().

◆ test_qp_flag_wildcard3_helper()

static void test_qp_flag_wildcard3_helper ( const Xapian::Database db,
Xapian::termcount  max_expansion,
const string &  query_string 
)
static

◆ time_query_parse()

static double time_query_parse ( const Xapian::Database db,
const string &  q,
int  repetitions,
unsigned  flags 
)
static

Variable Documentation

◆ test_and_queries

const test test_and_queries[]
static
Initial value:
= {
{ "internet explorer title:(http www)", "(Zinternet@1 AND Zexplor@2 AND (ZXThttp@3 AND ZXTwww@4))" },
{ "one +two three", "(Zone@1 AND Ztwo@2 AND Zthree@3)" },
{ "hello -title:\"hello world\"", "(Zhello@1 AND_NOT (XThello@2 PHRASE 2 XTworld@3))" },
{ "\"hello world\" -C++", "((hello@1 PHRASE 2 world@2) AND_NOT c++@3)" },
{ "-cup site:world", "(0 * Hworld AND_NOT Zcup@1)" },
{ "site:world -cup", "(0 * Hworld AND_NOT Zcup@1)" },
{ "(site:world) -cup", "(0 * Hworld AND_NOT Zcup@1)" },
{ "foo site:xapian.org bar", "((Zfoo@1 AND Zbar@2) FILTER Hxapian.org)" },
{ "a b site:xapian.org", "((Za@1 AND Zb@2) FILTER Hxapian.org)" },
{ "site:xapian.org a b", "((Za@1 AND Zb@2) FILTER Hxapian.org)" },
{ NULL, "NGRAMS" },
{ "author:험가 OR subject:万众 hello world!", "((A험@1 AND A험가@1 AND A가@1) OR (XT万@2 AND XT万众@2 AND XT众@2 AND (Zhello@3 AND Zworld@4)))" },
{ "洛伊one儿差点two脸three", "(洛@1 AND 洛伊@1 AND 伊@1 AND Zone@2 AND (儿@3 AND 儿差@3 AND 差@3 AND 差点@3 AND 点@3) AND Ztwo@4 AND 脸@5 AND Zthree@6)" },
{ NULL, NULL }
}

Definition at line 782 of file api_queryparser.cc.

◆ test_fieldproc1_queries

const test test_fieldproc1_queries[]
static
Initial value:
= {
{ "title:test", "Stest" },
{ "subject:test", "Stest" },
{ "title:all", "<alldocuments>" },
{ "host:Xapian.org", "0 * Hxapian.org" },
{ "host2:Xapian.org", "0 * Hxapian.org" },
{ "host:*", "0 * <alldocuments>" },
{ "host:\"Space Station.Example.Org\"", "0 * Hspace station.example.org" },
{ NULL, NULL }
}

Definition at line 2166 of file api_queryparser.cc.

◆ test_fieldproc2_queries

const test test_fieldproc2_queries[]
static
Initial value:
= {
{ "date:\"this week\"", "VALUE_GE 1 20120723" },
{ "date:23/7/2012..25/7/2012", "VALUE_RANGE 1 20120723 20120725" },
{ NULL, NULL }
}

Definition at line 2228 of file api_queryparser.cc.

◆ test_mispelled_partial_queries

const test test_mispelled_partial_queries[]
static
Initial value:
= {
{ "doucment", "" },
{ "doucment ", "document " },
{ "documen", "" },
{ "documen ", "document " },
{ "seearch documen", "search documen" },
{ "search documen", "" },
{ NULL, NULL }
}

Definition at line 2449 of file api_queryparser.cc.

◆ test_mispelled_queries

const test test_mispelled_queries[]
static
Initial value:
= {
{ "doucment search", "document search" },
{ "doucment seeacrh", "document search" },
{ "docment seeacrh test", "document search test" },
{ "\"paragahp pineapple\"", "\"paragraph pineapple\"" },
{ "\"paragahp pineapple\"", "\"paragraph pineapple\"" },
{ "test S.E.A.R.C.", "" },
{ "this AND that", "" },
{ "documento", "document" },
{ "documento-documento", "document-document" },
{ "documento-searcho", "document-search" },
{ "test saerch", "test search" },
{ "paragraf search", "paragraph search" },
{ NULL, NULL }
}

Definition at line 2321 of file api_queryparser.cc.

◆ test_mispelled_wildcard_queries

const test test_mispelled_wildcard_queries[]
static
Initial value:
= {
{ "doucment", "document" },
{ "doucment*", "" },
{ "doucment* seearch", "doucment* search" },
{ "doucment* search", "" },
{ NULL, NULL }
}

Definition at line 2412 of file api_queryparser.cc.

◆ test_multi_synonym_queries

const test test_multi_synonym_queries[]
static
Initial value:
= {
{ "sun OR tan OR cream", "(Zsun@1 OR Ztan@2 OR Zcream@3)" },
{ "sun tan", "((Zsun@1 OR Ztan@2) SYNONYM bathe@1)" },
{ "sun tan cream", "((Zsun@1 OR Ztan@2 OR Zcream@3) SYNONYM lotion@1)" },
{ "beach sun tan holiday", "(Zbeach@1 OR ((Zsun@2 OR Ztan@3) SYNONYM bathe@2) OR Zholiday@4)" },
{ "sun tan sun tan cream", "(((Zsun@1 OR Ztan@2) SYNONYM bathe@1) OR ((Zsun@3 OR Ztan@4 OR Zcream@5) SYNONYM lotion@3))" },
{ "single", "(Zsingl@1 SYNONYM record@1)" },
{ NULL, NULL }
}

Definition at line 2527 of file api_queryparser.cc.

◆ test_near_queries

const test test_near_queries[]
static

Definition at line 2782 of file api_queryparser.cc.

◆ test_or_queries

const test test_or_queries[]
static

Definition at line 48 of file api_queryparser.cc.

◆ test_phrase_queries

const test test_phrase_queries[]
static

Definition at line 2853 of file api_queryparser.cc.

◆ test_pure_not_queries

const test test_pure_not_queries[]
static
Initial value:
= {
{ "NOT windows", "(<alldocuments> AND_NOT Zwindow@1)" },
{ "a AND (NOT b)", "(Za@1 AND (<alldocuments> AND_NOT Zb@2))" },
{ "AND NOT windows", "Syntax: <expression> AND NOT <expression>" },
{ "gordian NOT", "Syntax: <expression> NOT <expression>" },
{ "gordian AND NOT", "Syntax: <expression> AND NOT <expression>" },
{ NULL, NULL }
}

Definition at line 1339 of file api_queryparser.cc.

◆ test_stem_all_queries

const test test_stem_all_queries[]
static
Initial value:
= {
{ "\"chemical engineers\"", "(chemic@1 PHRASE 2 engin@2)" },
{ "chemical NEAR engineers", "(chemic@1 NEAR 11 engin@2)" },
{ "chemical engineers", "(chemic@1 OR engin@2)" },
{ "title:(chemical engineers)", "(XTchemic@1 OR XTengin@2)" },
{ NULL, NULL }
}

Definition at line 2620 of file api_queryparser.cc.

◆ test_stem_all_z_queries

const test test_stem_all_z_queries[]
static
Initial value:
= {
{ "\"chemical engineers\"", "(Zchemic@1 PHRASE 2 Zengin@2)" },
{ "chemical NEAR engineers", "(Zchemic@1 NEAR 11 Zengin@2)" },
{ "chemical engineers", "(Zchemic@1 OR Zengin@2)" },
{ "title:(chemical engineers)", "(ZXTchemic@1 OR ZXTengin@2)" },
{ NULL, NULL }
}

Definition at line 2655 of file api_queryparser.cc.

◆ test_stop_queries

const test test_stop_queries[]
static
Initial value:
= {
{ "test the queryparser", "(test@1 AND queryparser@3)" },
{ "test AND the AND queryparser", "(test@1 AND the@2 AND queryparser@3)" },
{ "the", "the@1" },
{ "an the a", "(an@1 AND the@2 AND a@3)" },
{ "the AND a an", "(the@1 AND (a@2 AND an@3))" },
{ NULL, NULL }
}

Definition at line 1292 of file api_queryparser.cc.

◆ test_stopword_group_and_queries

const test test_stopword_group_and_queries[]
static
Initial value:
= {
{ "this is a test", "test@4" },
{ "test*", "WILDCARD SYNONYM test" },
{ "a test*", "WILDCARD SYNONYM test" },
{ "is a test*", "WILDCARD SYNONYM test" },
{ "this is a test*", "WILDCARD SYNONYM test" },
{ "this is a us* test*", "(WILDCARD SYNONYM us AND WILDCARD SYNONYM test)" },
{ "this is a user test*", "(user@4 AND WILDCARD SYNONYM test)" },
{ NULL, NULL }
}

Definition at line 2939 of file api_queryparser.cc.

Referenced by DEFINE_TESTCASE().

◆ test_stopword_group_or_queries

const test test_stopword_group_or_queries[]
static
Initial value:
= {
{ "this is a test", "test@4" },
{ "test*", "WILDCARD SYNONYM test" },
{ "a test*", "WILDCARD SYNONYM test" },
{ "is a test*", "WILDCARD SYNONYM test" },
{ "this is a test*", "WILDCARD SYNONYM test" },
{ "this is a us* test*", "(WILDCARD SYNONYM us OR WILDCARD SYNONYM test)" },
{ "this is a user test*", "(user@4 OR WILDCARD SYNONYM test)" },
{ NULL, NULL }
}

Definition at line 2928 of file api_queryparser.cc.

Referenced by DEFINE_TESTCASE().

◆ test_synonym_op_queries

const test test_synonym_op_queries[]
static
Initial value:
= {
{ "searching", "Zsearch@1" },
{ "~searching", "(Zsearch@1 SYNONYM Zfind@1 SYNONYM Zlocate@1)" },
{ "~search", "(Zsearch@1 SYNONYM find@1)" },
{ "~Search", "(search@1 SYNONYM find@1)" },
{ "~Searching", "searching@1" },
{ "~searching OR terms", "((Zsearch@1 SYNONYM Zfind@1 SYNONYM Zlocate@1) OR Zterm@2)" },
{ "~search OR terms", "((Zsearch@1 SYNONYM find@1) OR Zterm@2)" },
{ "~search +terms", "(Zterm@2 AND_MAYBE (Zsearch@1 SYNONYM find@1))" },
{ "~search -terms", "((Zsearch@1 SYNONYM find@1) AND_NOT Zterm@2)" },
{ "+~search terms", "((Zsearch@1 SYNONYM find@1) AND_MAYBE Zterm@2)" },
{ "-~search terms", "(Zterm@2 AND_NOT (Zsearch@1 SYNONYM find@1))" },
{ "~search terms", "((Zsearch@1 SYNONYM find@1) OR Zterm@2)" },
{ "~foo:search", "(ZXFOOsearch@1 SYNONYM prefixated@1)" },
{ "~\"search terms\"", "(search@1 PHRASE 2 terms@2)" },
{ NULL, NULL }
}

Definition at line 2566 of file api_queryparser.cc.

◆ test_synonym_queries

const test test_synonym_queries[]
static
Initial value:
= {
{ "searching", "(Zsearch@1 SYNONYM Zfind@1 SYNONYM Zlocate@1)" },
{ "search", "(Zsearch@1 SYNONYM find@1)" },
{ "Search", "(search@1 SYNONYM find@1)" },
{ "Searching", "searching@1" },
{ "searching OR terms", "((Zsearch@1 SYNONYM Zfind@1 SYNONYM Zlocate@1) OR Zterm@2)" },
{ "search OR terms", "((Zsearch@1 SYNONYM find@1) OR Zterm@2)" },
{ "search +terms", "(Zterm@2 AND_MAYBE (Zsearch@1 SYNONYM find@1))" },
{ "search -terms", "((Zsearch@1 SYNONYM find@1) AND_NOT Zterm@2)" },
{ "+search terms", "((Zsearch@1 SYNONYM find@1) AND_MAYBE Zterm@2)" },
{ "-search terms", "(Zterm@2 AND_NOT (Zsearch@1 SYNONYM find@1))" },
{ "search terms", "((Zsearch@1 SYNONYM find@1) OR Zterm@2)" },
{ "\"search terms\"", "(search@1 PHRASE 2 terms@2)" },
{ "regression test", "(Zregress@1 OR Ztest@2)" },
{ NULL, NULL }
}

Definition at line 2477 of file api_queryparser.cc.

◆ test_value_customrange1_queries

const test test_value_customrange1_queries[]
static
Initial value:
= {
{ "mars author:Asimov..Bradbury", "(mars@1 FILTER VALUE_RANGE 4 asimov bradbury)" },
{ NULL, NULL }
}

Definition at line 2063 of file api_queryparser.cc.

◆ test_value_daterange1_queries

const test test_value_daterange1_queries[]
static
Initial value:
= {
{ "12/03/99..12/04/01", "VALUE_RANGE 1 19991203 20011204" },
{ "03-12-99..04-14-01", "VALUE_RANGE 1 19990312 20010414" },
{ "01/30/60..02/02/59", "VALUE_RANGE 1 19600130 20590202" },
{ "1999-03-12..2001-04-14", "VALUE_RANGE 1 19990312 20010414" },
{ "12/03/99..02", "Unknown range operation" },
{ "1999-03-12..2001", "Unknown range operation" },
{ NULL, NULL }
}

Definition at line 1847 of file api_queryparser.cc.

◆ test_value_daterange2_queries

const test test_value_daterange2_queries[]
static
Initial value:
= {
{ "created:12/03/99..12/04/01", "VALUE_RANGE 1 19991203 20011204" },
{ "modified:03-12-99..04-14-01", "VALUE_RANGE 2 19990312 20010414" },
{ "accessed:01/30/70..02/02/69", "VALUE_RANGE 3 19700130 20690202" },
{ "deleted:12/03/99..12/04/01", "VALUE_RANGE 4 19990312 20010412" },
{ "1999-03-12..2001-04-14", "Unknown range operation" },
{ "12/03/99..created:12/04/01", "Unknown range operation" },
{ "12/03/99created:..12/04/01", "Unknown range operation" },
{ "12/03/99..12/04/01created:", "Unknown range operation" },
{ "12/03/99..02", "Unknown range operation" },
{ "1999-03-12..2001", "Unknown range operation" },
{ NULL, NULL }
}

Definition at line 1911 of file api_queryparser.cc.

◆ test_value_range1_queries

const test test_value_range1_queries[]
static
Initial value:
= {
{ "a..b", "VALUE_RANGE 1 a b" },
{ "$50..100", "VALUE_RANGE 1 $50 100" },
{ "$50..$99", "VALUE_RANGE 1 $50 $99" },
{ "$50..$100", "" },
{ "02/03/1979..10/12/1980", "VALUE_RANGE 1 02/03/1979 10/12/1980" },
{ "a..b hello", "(hello@1 FILTER VALUE_RANGE 1 a b)" },
{ "hello a..b", "(hello@1 FILTER VALUE_RANGE 1 a b)" },
{ "hello a..b world", "((hello@1 OR world@2) FILTER VALUE_RANGE 1 a b)" },
{ "hello a..b test:foo", "(hello@1 FILTER (VALUE_RANGE 1 a b AND XTESTfoo))" },
{ "hello a..b test:foo test:bar", "(hello@1 FILTER (VALUE_RANGE 1 a b AND (XTESTfoo OR XTESTbar)))" },
{ "hello a..b c..d test:foo", "(hello@1 FILTER ((VALUE_RANGE 1 a b OR VALUE_RANGE 1 c d) AND XTESTfoo))" },
{ "hello a..b c..d test:foo test:bar", "(hello@1 FILTER ((VALUE_RANGE 1 a b OR VALUE_RANGE 1 c d) AND (XTESTfoo OR XTESTbar)))" },
{ "-5..7", "VALUE_RANGE 1 -5 7" },
{ "hello -5..7", "(hello@1 FILTER VALUE_RANGE 1 -5 7)" },
{ "-5..7 hello", "(hello@1 FILTER VALUE_RANGE 1 -5 7)" },
{ "\"time flies\" 09:00..12:30", "((time@1 PHRASE 2 flies@2) FILTER VALUE_RANGE 1 09:00 12:30)" },
{ "..b", "VALUE_LE 1 b" },
{ "a..", "VALUE_GE 1 a" },
{ "10:30+1300..11:00+1300", "VALUE_RANGE 1 10:30+1300 11:00+1300" },
{ NULL, NULL }
}

Definition at line 1496 of file api_queryparser.cc.

◆ test_value_range2_queries

const test test_value_range2_queries[]
static

Definition at line 1577 of file api_queryparser.cc.

◆ test_value_range4_queries

const test test_value_range4_queries[]
static
Initial value:
= {
{ "id:19254@foo..example.com", "0 * Q19254@foo..example.com" },
{ "hello:world", "0 * XHELLOworld" },
{ "hello:mum..world", "VALUE_RANGE 1 mum world" },
{ NULL, NULL }
}

Definition at line 1772 of file api_queryparser.cc.

◆ test_value_stringrange1_queries

const test test_value_stringrange1_queries[]
static
Initial value:
= {
{ "tag:bar..foo", "VALUE_RANGE 1 bar foo" },
{ "bar..foo", "VALUE_RANGE 0 bar foo" },
{ NULL, NULL }
}

Definition at line 1999 of file api_queryparser.cc.