xapian-core
1.4.26
|
tests snippets More...
#include <config.h>
#include "api_snippets.h"
#include <fstream>
#include <string>
#include <xapian.h>
#include "apitest.h"
#include "testsuite.h"
#include "testutils.h"
Go to the source code of this file.
Classes | |
struct | snippet_testcase |
Functions | |
DEFINE_TESTCASE (snippet1, backend) | |
Test snippets without stemming. More... | |
DEFINE_TESTCASE (snippetstem1, backend) | |
Test snippets with stemming. More... | |
DEFINE_TESTCASE (snippetphrase1, backend) | |
Test snippets with phrases. More... | |
static void | make_tg_db (Xapian::WritableDatabase &db, const string &source) |
Index file to a DB with TermGenerator. More... | |
DEFINE_TESTCASE (snippetmisc1, backend) | |
Test snippets in various ways. More... | |
DEFINE_TESTCASE (snippet_termcover1, backend) | |
Test snippet term diversity. More... | |
DEFINE_TESTCASE (snippet_termcover2, backend) | |
Test snippet term diversity cases with BoolWeight. More... | |
DEFINE_TESTCASE (snippet_empty, backend) | |
Test snippet EMPTY_WITHOUT_MATCH flag. More... | |
DEFINE_TESTCASE (snippet_start_nonspace, backend) | |
Check snippets include certain preceding punctuation. More... | |
DEFINE_TESTCASE (snippet_small_zerolength, backend) | |
Test snippets with small and zero length. More... | |
DEFINE_TESTCASE (snippet_ngrams, backend) | |
Test ngrams. More... | |
DEFINE_TESTCASE (snippet_empty_mset, backend) | |
DEFINE_TESTCASE (snippet_empty_mset2, !backend) | |
tests snippets
Definition in file api_snippets.cc.
DEFINE_TESTCASE | ( | snippet1 | , |
backend | |||
) |
Test snippets without stemming.
Definition at line 45 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippetstem1 | , |
backend | |||
) |
Test snippets with stemming.
Definition at line 79 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippetphrase1 | , |
backend | |||
) |
Test snippets with phrases.
Definition at line 102 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_PHRASE, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippetmisc1 | , |
backend | |||
) |
Test snippets in various ways.
Definition at line 161 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), make_tg_db(), Xapian::Query::OP_PHRASE, Xapian::Query::OP_WILDCARD, Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::size(), Xapian::MSet::snippet(), TEST_EQUAL, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | snippet_termcover1 | , |
backend | |||
) |
Test snippet term diversity.
Definition at line 207 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), Xapian::MSet::SNIPPET_EXHAUSTIVE, TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippet_termcover2 | , |
backend | |||
) |
Test snippet term diversity cases with BoolWeight.
Definition at line 236 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), Xapian::MSet::snippet(), Xapian::MSet::SNIPPET_EXHAUSTIVE, TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippet_empty | , |
backend | |||
) |
Test snippet EMPTY_WITHOUT_MATCH flag.
Definition at line 265 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), Xapian::MSet::SNIPPET_EMPTY_WITHOUT_MATCH, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | snippet_start_nonspace | , |
backend | |||
) |
Check snippets include certain preceding punctuation.
Definition at line 301 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::MSet::snippet(), and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | snippet_small_zerolength | , |
backend | |||
) |
Test snippets with small and zero length.
Definition at line 462 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::MSet::snippet(), TEST_STRINGS_EQUAL, and testcases.
DEFINE_TESTCASE | ( | snippet_ngrams | , |
backend | |||
) |
Test ngrams.
Definition at line 489 of file api_snippets.cc.
References Xapian::WritableDatabase::add_document(), Xapian::QueryParser::FLAG_DEFAULT, Xapian::TermGenerator::FLAG_NGRAMS, Xapian::QueryParser::FLAG_NGRAMS, get_database(), Xapian::TermGenerator::index_text(), Xapian::QueryParser::parse_query(), Xapian::TermGenerator::set_document(), Xapian::TermGenerator::set_flags(), Xapian::MSet::snippet(), Xapian::MSet::SNIPPET_NGRAMS, and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | snippet_empty_mset | , |
backend | |||
) |
Definition at line 521 of file api_snippets.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::MSet::snippet(), and TEST_STRINGS_EQUAL.
DEFINE_TESTCASE | ( | snippet_empty_mset2 | , |
! | backend | ||
) |
Definition at line 528 of file api_snippets.cc.
References Xapian::MSet::snippet(), and TEST_STRINGS_EQUAL.
|
static |
Index file to a DB with TermGenerator.
Definition at line 129 of file api_snippets.cc.
References Xapian::WritableDatabase::add_document(), C_isnotspace(), FAIL_TEST, test_driver::get_srcdir(), Xapian::TermGenerator::index_text(), Xapian::Document::set_data(), Xapian::TermGenerator::set_document(), and Xapian::TermGenerator::set_stemmer().
Referenced by DEFINE_TESTCASE().