tests/queryparsertest.cc File Reference

#include <config.h>
#include <xapian.h>
#include <iostream>
#include <string>
#include <vector>
#include <math.h>
#include "omtime.h"
#include "unixcmds.h"
#include "utils.h"
#include "testsuite.h"
#include "testutils.h"

Include dependency graph for queryparsertest.cc:

Go to the source code of this file.

Classes

struct  test
struct  AuthorValueRangeProcessor

Defines

#define TESTCASE(S)   {#S, test_##S}
#define END_OF_TESTCASES   {0, 0}

Functions

static bool test_queryparser1 ()
static bool test_qp_default_op1 ()
static bool test_qp_default_prefix1 ()
static bool test_qp_default_prefix2 ()
static bool test_qp_odd_chars1 ()
static bool test_qp_flag_wildcard1 ()
static bool test_qp_flag_wildcard2 ()
static bool test_qp_flag_partial1 ()
static bool test_qp_flag_bool_any_case1 ()
static bool test_qp_stopper1 ()
static bool test_qp_flag_pure_not1 ()
static bool test_qp_unstem_boolean_prefix ()
static bool test_qp_value_range1 ()
static bool test_qp_value_range2 ()
static bool test_qp_value_range3 ()
static bool test_value_range_serialise1 ()
static bool test_qp_value_daterange1 ()
static bool test_qp_value_customrange1 ()
static bool test_qp_stoplist1 ()
static bool test_qp_spell1 ()
static bool test_qp_spell2 ()
static bool test_qp_synonym1 ()
static bool test_qp_synonym2 ()
static bool test_qp_synonym3 ()
static bool test_qp_stem_all1 ()
static double time_query_parse (const Xapian::Database &db, const string &q, int repetitions, unsigned flags)
static bool test_qp_stem_scale1 ()
int main (int argc, char **argv)

Variables

static test test_or_queries []
static test test_and_queries []
static test test_stop_queries []
static test test_pure_not_queries []
static test test_value_range1_queries []
static test test_value_range2_queries []
static const double test_value_range_numbers []
static test test_value_daterange1_queries []
static test test_value_customrange1_queries []
static test test_mispelled_queries []
static test test_synonym_queries []
static test test_multi_synonym_queries []
static test test_synonym_op_queries []
static test test_stem_all_queries []
static test_desc tests []
 Test cases for the QueryParser.


Define Documentation

#define TESTCASE (  )     {#S, test_##S}

Definition at line 36 of file queryparsertest.cc.

#define END_OF_TESTCASES   {0, 0}

Definition at line 37 of file queryparsertest.cc.


Function Documentation

static bool test_queryparser1 (  )  [static]

Definition at line 595 of file queryparsertest.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::QueryParser::add_prefix(), Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, TEST_EXCEPTION, test_or_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_default_op1 (  )  [static]

Definition at line 666 of file queryparsertest.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::QueryParser::add_prefix(), Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::Query::OP_AND, Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_default_op(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, test_and_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_default_prefix1 (  )  [static]

Definition at line 700 of file queryparsertest.cc.

References Xapian::QueryParser::add_prefix(), Xapian::QueryParser::FLAG_BOOLEAN, Xapian::Query::get_description(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, and TEST_STRINGS_EQUAL.

static bool test_qp_default_prefix2 (  )  [static]

Definition at line 719 of file queryparsertest.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::QueryParser::add_prefix(), Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_PHRASE, Xapian::Query::get_description(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, TEST_EXCEPTION, and TEST_STRINGS_EQUAL.

static bool test_qp_odd_chars1 (  )  [static]

Definition at line 760 of file queryparsertest.cc.

References Xapian::Query::get_description(), Xapian::QueryParser::parse_query(), query(), TEST_STRINGS_EQUAL, and tout.

static bool test_qp_flag_wildcard1 (  )  [static]

Definition at line 771 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::QueryParser::FLAG_LOVEHATE, Xapian::QueryParser::FLAG_WILDCARD, Xapian::Query::get_description(), Xapian::Query::OP_AND, Xapian::InMemory::open(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_database(), Xapian::QueryParser::set_default_op(), and TEST_STRINGS_EQUAL.

static bool test_qp_flag_wildcard2 (  )  [static]

Definition at line 868 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_document(), Xapian::QueryParser::add_prefix(), Xapian::Document::add_term(), Xapian::QueryParser::FLAG_WILDCARD, Xapian::Query::get_description(), Xapian::InMemory::open(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_database(), and TEST_STRINGS_EQUAL.

static bool test_qp_flag_partial1 (  )  [static]

Definition at line 888 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_document(), Xapian::QueryParser::add_prefix(), Xapian::Document::add_term(), Xapian::QueryParser::FLAG_PARTIAL, Xapian::QueryParser::FLAG_WILDCARD, Xapian::Query::get_description(), Xapian::InMemory::open(), Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_ALL, Xapian::QueryParser::STEM_SOME, stemmer, and TEST_STRINGS_EQUAL.

static bool test_qp_flag_bool_any_case1 (  )  [static]

Definition at line 989 of file queryparsertest.cc.

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

static bool test_qp_stopper1 (  )  [static]

Definition at line 1020 of file queryparsertest.cc.

References Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::Query::OP_AND, Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_default_op(), Xapian::QueryParser::set_stopper(), test_stop_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_flag_pure_not1 (  )  [static]

Definition at line 1059 of file queryparsertest.cc.

References Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), test_pure_not_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_unstem_boolean_prefix (  )  [static]

Definition at line 1093 of file queryparsertest.cc.

References Xapian::QueryParser::add_boolean_prefix(), Xapian::Query::get_description(), Xapian::QueryParser::parse_query(), TEST, TEST_EQUAL, TEST_STRINGS_EQUAL, Xapian::QueryParser::unstem_begin(), and Xapian::QueryParser::unstem_end().

static bool test_qp_value_range1 (  )  [static]

Definition at line 1127 of file queryparsertest.cc.

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

static bool test_qp_value_range2 (  )  [static]

Definition at line 1177 of file queryparsertest.cc.

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

static bool test_qp_value_range3 (  )  [static]

Definition at line 1215 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_document(), Xapian::Document::add_value(), Xapian::QueryParser::add_valuerangeprocessor(), Xapian::Enquire::get_mset(), om_tostring(), Xapian::InMemory::open(), Xapian::QueryParser::parse_query(), query(), Xapian::Enquire::set_query(), Xapian::MSet::size(), Xapian::sortable_serialise(), TEST_EQUAL, and tout.

static bool test_value_range_serialise1 (  )  [static]

Definition at line 1311 of file queryparsertest.cc.

References Xapian::sortable_serialise(), Xapian::sortable_unserialise(), TEST_AND_EXPLAIN, TEST_EQUAL, test_value_range_numbers, and tout.

static bool test_qp_value_daterange1 (  )  [static]

Definition at line 1361 of file queryparsertest.cc.

References Xapian::QueryParser::add_valuerangeprocessor(), Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), test::query, TEST_STRINGS_EQUAL, test_value_daterange1_queries, and tout.

static bool test_qp_value_customrange1 (  )  [static]

Definition at line 1408 of file queryparsertest.cc.

References Xapian::QueryParser::add_valuerangeprocessor(), Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), test::query, TEST_STRINGS_EQUAL, test_value_customrange1_queries, and tout.

static bool test_qp_stoplist1 (  )  [static]

Definition at line 1436 of file queryparsertest.cc.

References Xapian::QueryParser::parse_query(), Xapian::QueryParser::set_stopper(), Xapian::QueryParser::stoplist_begin(), Xapian::QueryParser::stoplist_end(), TEST, and TEST_EQUAL.

static bool test_qp_spell1 (  )  [static]

Definition at line 1483 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_spelling(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_SPELLING_CORRECTION, Xapian::QueryParser::get_corrected_query_string(), mkdir(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, test_mispelled_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_spell2 (  )  [static]

Definition at line 1511 of file queryparsertest.cc.

References Xapian::Database::add_database(), Xapian::WritableDatabase::add_spelling(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_SPELLING_CORRECTION, Xapian::WritableDatabase::flush(), Xapian::QueryParser::get_corrected_query_string(), mkdir(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, test_mispelled_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_synonym1 (  )  [static]

Definition at line 1566 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_synonym(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_AUTO_SYNONYMS, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_LOVEHATE, Xapian::QueryParser::FLAG_PHRASE, Xapian::WritableDatabase::flush(), Xapian::Query::get_description(), mkdir(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, TEST_STRINGS_EQUAL, test_synonym_queries, and tout.

static bool test_qp_synonym2 (  )  [static]

Definition at line 1612 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_synonym(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_LOVEHATE, Xapian::QueryParser::FLAG_PHRASE, Xapian::WritableDatabase::flush(), Xapian::Query::get_description(), mkdir(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, test_multi_synonym_queries, TEST_STRINGS_EQUAL, and tout.

static bool test_qp_synonym3 (  )  [static]

Definition at line 1665 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_synonym(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_LOVEHATE, Xapian::QueryParser::FLAG_PHRASE, Xapian::QueryParser::FLAG_SYNONYM, Xapian::WritableDatabase::flush(), Xapian::Query::get_description(), mkdir(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_database(), Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_SOME, TEST_STRINGS_EQUAL, test_synonym_op_queries, and tout.

static bool test_qp_stem_all1 (  )  [static]

Definition at line 1707 of file queryparsertest.cc.

References Xapian::Error::get_description(), Xapian::Error::get_msg(), Xapian::QueryParser::parse_query(), test::query, Xapian::QueryParser::set_stemmer(), Xapian::QueryParser::set_stemming_strategy(), Xapian::QueryParser::STEM_ALL, test_stem_all_queries, TEST_STRINGS_EQUAL, and tout.

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

Definition at line 1735 of file queryparsertest.cc.

References OmTime::now(), Xapian::Query::OP_OR, Xapian::QueryParser::parse_query(), and Xapian::QueryParser::set_database().

Referenced by test_qp_stem_scale1().

static bool test_qp_stem_scale1 (  )  [static]

Definition at line 1761 of file queryparsertest.cc.

References Xapian::WritableDatabase::add_synonym(), Xapian::DB_CREATE_OR_OVERWRITE, Xapian::QueryParser::FLAG_AUTO_MULTIWORD_SYNONYMS, Xapian::QueryParser::FLAG_BOOLEAN, Xapian::QueryParser::FLAG_LOVEHATE, Xapian::QueryParser::FLAG_PHRASE, Xapian::QueryParser::FLAG_SYNONYM, Xapian::WritableDatabase::flush(), mkdir(), SKIP_TEST, TEST_LESSER, time_query_parse(), and tout.

int main ( int  argc,
char **  argv 
)

Definition at line 1876 of file queryparsertest.cc.

References test_driver::parse_command_line(), test_driver::run(), and tests.


Variable Documentation

test test_or_queries[] [static]

Definition at line 47 of file queryparsertest.cc.

Referenced by test_queryparser1().

test test_and_queries[] [static]

Initial value:

 {
    { "internet explorer title:(http www)", "(Zinternet:(pos=1) AND Zexplor:(pos=2) AND ZXThttp:(pos=3) AND ZXTwww:(pos=4))" },
    
    
    { "one +two three", "(Zone:(pos=1) AND Ztwo:(pos=2) AND Zthree:(pos=3))" },
    { "hello -title:\"hello world\"", "(Zhello:(pos=1) AND_NOT (XThello:(pos=2) PHRASE 2 XTworld:(pos=3)))" },
    
    
    { "\"hello world\" -C++", "((hello:(pos=1) PHRASE 2 world:(pos=2)) AND_NOT c++:(pos=3))" },
    
    
    { "-cup site:world", "(0 * Hworld AND_NOT Zcup:(pos=1))" },
    { "site:world -cup", "(0 * Hworld AND_NOT Zcup:(pos=1))" },
    
    { "(site:world) -cup", "(0 * Hworld AND_NOT Zcup:(pos=1))" },
    
    
    
    { "foo site:xapian.org bar", "((Zfoo:(pos=1) AND Zbar:(pos=2)) FILTER Hxapian.org)" },
    
    { "a b site:xapian.org", "((Za:(pos=1) AND Zb:(pos=2)) FILTER Hxapian.org)" },
    { "site:xapian.org a b", "((Za:(pos=1) AND Zb:(pos=2)) FILTER Hxapian.org)" },
    { NULL, NULL }
}

Definition at line 640 of file queryparsertest.cc.

Referenced by test_qp_default_op1().

test test_stop_queries[] [static]

Initial value:

 {
    { "test the queryparser", "(test:(pos=1) AND queryparser:(pos=3))" },
    
    
    { "test AND the AND queryparser", "(test:(pos=1) AND the:(pos=2) AND queryparser:(pos=3))" },
    
    
    
    
    
    { "the", "the:(pos=1)" },
    { NULL, NULL }
}

Definition at line 1006 of file queryparsertest.cc.

Referenced by test_qp_stopper1().

test test_pure_not_queries[] [static]

Initial value:

 {
    { "NOT windows", "(<alldocuments> AND_NOT Zwindow:(pos=1))" },
    { "a AND (NOT b)", "(Za:(pos=1) AND (<alldocuments> AND_NOT Zb:(pos=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 1050 of file queryparsertest.cc.

Referenced by test_qp_flag_pure_not1().

test test_value_range1_queries[] [static]

Initial value:

 {
    { "a..b", "VALUE_RANGE 1 a b" },
    { "$50..100", "VALUE_RANGE 1 $50 100" },
    { "$50..$100", "VALUE_RANGE 1 $50 $100" },
    { "02/03/1979..10/12/1980", "VALUE_RANGE 1 02/03/1979 10/12/1980" },
    { "a..b hello", "(hello:(pos=1) FILTER VALUE_RANGE 1 a b)" },
    { "hello a..b", "(hello:(pos=1) FILTER VALUE_RANGE 1 a b)" },
    { "hello a..b world", "((hello:(pos=1) OR world:(pos=2)) FILTER VALUE_RANGE 1 a b)" },
    { "hello a..b test:foo", "(hello:(pos=1) FILTER (VALUE_RANGE 1 a b AND XTESTfoo))" },
    { "hello a..b test:foo test:bar", "(hello:(pos=1) FILTER (VALUE_RANGE 1 a b AND (XTESTfoo OR XTESTbar)))" },
    { "hello a..b c..d test:foo", "(hello:(pos=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:(pos=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:(pos=1) FILTER VALUE_RANGE 1 -5 7)" },
    { "-5..7 hello", "(hello:(pos=1) FILTER VALUE_RANGE 1 -5 7)" },
    { "\"time flies\" 09:00..12:30", "((time:(pos=1) PHRASE 2 flies:(pos=2)) FILTER VALUE_RANGE 1 09:00 12:30)" },
    { NULL, NULL }
}

Definition at line 1107 of file queryparsertest.cc.

Referenced by test_qp_value_range1().

test test_value_range2_queries[] [static]

Initial value:

 {
    { "a..b", "VALUE_RANGE 3 a b" },
    { "1..12", "VALUE_RANGE 2 \240 \256" },
    { "20070201..20070228", "VALUE_RANGE 1 20070201 20070228" },
    { "$10..20", "VALUE_RANGE 4 \255 \261" },
    { "$10..$20", "VALUE_RANGE 4 \255 \261" },
    { "12..42kg", "VALUE_RANGE 5 \256 \265@" },
    { "12kg..42kg", "VALUE_RANGE 5 \256 \265@" },
    { "12kg..42", "VALUE_RANGE 3 12kg 42" },
    { "10..$20", "VALUE_RANGE 3 10 $20" },
    { "1999-03-12..2020-12-30", "VALUE_RANGE 1 19990312 20201230" },
    { "1999/03/12..2020/12/30", "VALUE_RANGE 1 19990312 20201230" },
    { "1999.03.12..2020.12.30", "VALUE_RANGE 1 19990312 20201230" },
    { "12/03/99..12/04/01", "VALUE_RANGE 1 19990312 20010412" },
    { "03-12-99..04-14-01", "VALUE_RANGE 1 19990312 20010414" },
    { "(test:a..test:b hello)", "(hello:(pos=1) FILTER VALUE_RANGE 3 test:a test:b)" },
    { "12..42kg 5..6kg 1..12", "0 * (VALUE_RANGE 2 \240 \256 AND (VALUE_RANGE 5 \256 \265@ OR VALUE_RANGE 5 \251 \252))" },
    { NULL, NULL }
}

Definition at line 1156 of file queryparsertest.cc.

Referenced by test_qp_value_range2().

const double test_value_range_numbers[] [static]

Definition at line 1258 of file queryparsertest.cc.

Referenced by test_value_range_serialise1().

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 1350 of file queryparsertest.cc.

Referenced by test_qp_value_daterange1().

test test_value_customrange1_queries[] [static]

Initial value:

 {
    { "mars author:Asimov..Bradbury", "(mars:(pos=1) FILTER VALUE_RANGE 4 asimov bradbury)" },
    { NULL, NULL }
}

Definition at line 1402 of file queryparsertest.cc.

Referenced by test_qp_value_customrange1().

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" },
    { NULL, NULL }
}

Definition at line 1468 of file queryparsertest.cc.

Referenced by test_qp_spell1(), and test_qp_spell2().

test test_synonym_queries[] [static]

Initial value:

 {
    { "searching", "(Zsearch:(pos=1) OR Zfind:(pos=1) OR Zlocate:(pos=1))" },
    { "search", "(Zsearch:(pos=1) OR find:(pos=1))" },
    { "Search", "(search:(pos=1) OR find:(pos=1))" },
    { "Searching", "searching:(pos=1)" },
    { "searching OR terms", "(Zsearch:(pos=1) OR Zfind:(pos=1) OR Zlocate:(pos=1) OR Zterm:(pos=2))" },
    { "search OR terms", "(Zsearch:(pos=1) OR find:(pos=1) OR Zterm:(pos=2))" },
    { "search +terms", "(Zterm:(pos=2) AND_MAYBE (Zsearch:(pos=1) OR find:(pos=1)))" },
    { "search -terms", "((Zsearch:(pos=1) OR find:(pos=1)) AND_NOT Zterm:(pos=2))" },
    { "+search terms", "((Zsearch:(pos=1) OR find:(pos=1)) AND_MAYBE Zterm:(pos=2))" },
    { "-search terms", "(Zterm:(pos=2) AND_NOT (Zsearch:(pos=1) OR find:(pos=1)))" },
    { "search terms", "(Zsearch:(pos=1) OR find:(pos=1) OR Zterm:(pos=2))" },
    
    { "\"search terms\"", "(search:(pos=1) PHRASE 2 terms:(pos=2))" },
    { NULL, NULL }
}

Definition at line 1548 of file queryparsertest.cc.

Referenced by test_qp_synonym1().

test test_multi_synonym_queries[] [static]

Initial value:

 {
    { "sun OR tan OR cream", "(Zsun:(pos=1) OR Ztan:(pos=2) OR Zcream:(pos=3))" },
    { "sun tan", "(Zsun:(pos=1) OR Ztan:(pos=2) OR bathe:(pos=1))" },
    { "sun tan cream", "(Zsun:(pos=1) OR Ztan:(pos=2) OR Zcream:(pos=3) OR lotion:(pos=1))" },
    { "beach sun tan holiday", "(Zbeach:(pos=1) OR Zsun:(pos=2) OR Ztan:(pos=3) OR bathe:(pos=2) OR Zholiday:(pos=4))" },
    { "sun tan sun tan cream", "(Zsun:(pos=1) OR Ztan:(pos=2) OR bathe:(pos=1) OR Zsun:(pos=3) OR Ztan:(pos=4) OR Zcream:(pos=5) OR lotion:(pos=3))" },
    { "single", "(Zsingl:(pos=1) OR record:(pos=1))" },
    { NULL, NULL }
}

Definition at line 1601 of file queryparsertest.cc.

Referenced by test_qp_synonym2().

test test_synonym_op_queries[] [static]

Initial value:

 {
    { "searching", "Zsearch:(pos=1)" },
    { "~searching", "(Zsearch:(pos=1) OR Zfind:(pos=1) OR Zlocate:(pos=1))" },
    { "~search", "(Zsearch:(pos=1) OR find:(pos=1))" },
    { "~Search", "(search:(pos=1) OR find:(pos=1))" },
    { "~Searching", "searching:(pos=1)" },
    { "~searching OR terms", "(Zsearch:(pos=1) OR Zfind:(pos=1) OR Zlocate:(pos=1) OR Zterm:(pos=2))" },
    { "~search OR terms", "(Zsearch:(pos=1) OR find:(pos=1) OR Zterm:(pos=2))" },
    { "~search +terms", "(Zterm:(pos=2) AND_MAYBE (Zsearch:(pos=1) OR find:(pos=1)))" },
    { "~search -terms", "((Zsearch:(pos=1) OR find:(pos=1)) AND_NOT Zterm:(pos=2))" },
    { "+~search terms", "((Zsearch:(pos=1) OR find:(pos=1)) AND_MAYBE Zterm:(pos=2))" },
    { "-~search terms", "(Zterm:(pos=2) AND_NOT (Zsearch:(pos=1) OR find:(pos=1)))" },
    { "~search terms", "(Zsearch:(pos=1) OR find:(pos=1) OR Zterm:(pos=2))" },
    
    { "~\"search terms\"", "(search:(pos=1) PHRASE 2 terms:(pos=2))" },
    { NULL, NULL }
}

Definition at line 1646 of file queryparsertest.cc.

Referenced by test_qp_synonym3().

test test_stem_all_queries[] [static]

Initial value:

 {
    { "\"chemical engineers\"", "(chemic:(pos=1) PHRASE 2 engin:(pos=2))" },
    { "chemical NEAR engineers", "(chemic:(pos=1) NEAR 11 engin:(pos=2))" },
    { "chemical engineers", "(chemic:(pos=1) OR engin:(pos=2))" },
    { NULL, NULL }
}

Definition at line 1700 of file queryparsertest.cc.

Referenced by test_qp_stem_all1().

test_desc tests[] [static]

Initial value:

 {
    TESTCASE(queryparser1),
    TESTCASE(qp_default_op1),
    TESTCASE(qp_odd_chars1),
    TESTCASE(qp_flag_wildcard1),
    TESTCASE(qp_flag_wildcard2),
    TESTCASE(qp_flag_partial1),
    TESTCASE(qp_flag_bool_any_case1),
    TESTCASE(qp_stopper1),
    TESTCASE(qp_flag_pure_not1),
    TESTCASE(qp_unstem_boolean_prefix),
    TESTCASE(qp_default_prefix1),
    TESTCASE(qp_default_prefix2),
    TESTCASE(value_range_serialise1),
    TESTCASE(qp_value_range1),
    TESTCASE(qp_value_range2),
    TESTCASE(qp_value_range3),
    TESTCASE(qp_value_daterange1),
    TESTCASE(qp_value_customrange1),
    TESTCASE(qp_stoplist1),
    TESTCASE(qp_spell1),
    TESTCASE(qp_spell2),
    TESTCASE(qp_synonym1),
    TESTCASE(qp_synonym2),
    TESTCASE(qp_synonym3),
    TESTCASE(qp_stem_all1),
    TESTCASE(qp_stem_scale1),
    END_OF_TESTCASES
}
Test cases for the QueryParser.

Definition at line 1846 of file queryparsertest.cc.


Documentation for Xapian (version 1.0.10).
Generated on 24 Dec 2008 by Doxygen 1.5.2.