xapian-core
1.4.27
|
Tests of percentage calculations. More...
#include <config.h>
#include "api_percentages.h"
#include <xapian.h>
#include "apitest.h"
#include "str.h"
#include "testutils.h"
#include <cfloat>
Go to the source code of this file.
Classes | |
class | MyPostingSource |
class | ZWeight |
Functions | |
DEFINE_TESTCASE (consistency3, backend) | |
DEFINE_TESTCASE (pctcutoff4, backend &&!remote &&!multi) | |
Test for rounding errors in percentage weight calculations and cutoffs. More... | |
DEFINE_TESTCASE (pctcutoff5, backend) | |
Check we throw for a percentage cutoff while sorting primarily by value. More... | |
DEFINE_TESTCASE (topercent3, backend) | |
DEFINE_TESTCASE (topercent4, backend) | |
DEFINE_TESTCASE (topercent5, backend) | |
Test that a search with a non-existent term doesn't get 100%. More... | |
DEFINE_TESTCASE (topercent6, backend) | |
Test that OP_FILTER doesn't affect percentages. More... | |
static void | make_topercent7_db (Xapian::WritableDatabase &db, const string &) |
DEFINE_TESTCASE (topercent7, backend) | |
Test that a term with wdf always = 0 gets counted. More... | |
DEFINE_TESTCASE (checkzeromaxpartopt1, backend &&!remote) | |
Regression test for bug introduced in 1.3.1 and fixed in 1.3.2. More... | |
Tests of percentage calculations.
Definition in file api_percentages.cc.
DEFINE_TESTCASE | ( | consistency3 | , |
backend | |||
) |
Definition at line 39 of file api_percentages.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), Xapian::MSet::size(), TEST, TEST_EQUAL, TEST_EQUAL_DOUBLE, and tout.
DEFINE_TESTCASE | ( | pctcutoff4 | , |
backend &&!remote &&! | multi | ||
) |
Test for rounding errors in percentage weight calculations and cutoffs.
Definition at line 128 of file api_percentages.cc.
References MyPostingSource::append_docweight(), Xapian::MSet::begin(), Xapian::MSet::convert_to_percent(), Xapian::MSet::end(), get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_cutoff(), Xapian::Enquire::set_query(), Xapian::MSet::size(), TEST_EQUAL, and tout.
DEFINE_TESTCASE | ( | pctcutoff5 | , |
backend | |||
) |
Check we throw for a percentage cutoff while sorting primarily by value.
Definition at line 178 of file api_percentages.cc.
References get_database(), Xapian::Enquire::get_mset(), Xapian::Enquire::set_cutoff(), Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), Xapian::Enquire::set_sort_by_value_then_relevance(), and TEST_EXCEPTION.
DEFINE_TESTCASE | ( | topercent3 | , |
backend | |||
) |
Definition at line 199 of file api_percentages.cc.
References Xapian::MSet::begin(), Xapian::MSet::end(), get_database(), Xapian::Enquire::get_mset(), Xapian::MSetIterator::get_percent(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::Enquire::set_sort_by_value(), and TEST_REL.
DEFINE_TESTCASE | ( | topercent4 | , |
backend | |||
) |
Definition at line 218 of file api_percentages.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_FILTER, Xapian::Query::OP_XOR, query(), Xapian::Enquire::set_query(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | topercent5 | , |
backend | |||
) |
Test that a search with a non-existent term doesn't get 100%.
Definition at line 236 of file api_percentages.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), TEST, and TEST_REL.
DEFINE_TESTCASE | ( | topercent6 | , |
backend | |||
) |
Test that OP_FILTER doesn't affect percentages.
Definition at line 259 of file api_percentages.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), Xapian::Query::OP_FILTER, Xapian::Query::OP_OR, Xapian::Enquire::set_query(), TEST, and TEST_EQUAL.
DEFINE_TESTCASE | ( | topercent7 | , |
backend | |||
) |
Test that a term with wdf always = 0 gets counted.
Definition at line 292 of file api_percentages.cc.
References Xapian::MSet::empty(), get_database(), Xapian::Enquire::get_mset(), make_topercent7_db(), Xapian::Query::OP_AND, Xapian::Query::OP_OR, Xapian::Enquire::set_query(), TEST, and TEST_REL.
DEFINE_TESTCASE | ( | checkzeromaxpartopt1 | , |
backend &&! | remote | ||
) |
Regression test for bug introduced in 1.3.1 and fixed in 1.3.2.
Definition at line 337 of file api_percentages.cc.
References get_database(), Xapian::Database::get_doccount(), Xapian::Enquire::get_mset(), Xapian::Query::OP_OR, Xapian::Enquire::set_query(), Xapian::Enquire::set_weighting_scheme(), TEST, and TEST_REL.
|
static |
Definition at line 276 of file api_percentages.cc.
References Xapian::Document::add_boolean_term(), Xapian::WritableDatabase::add_document(), Xapian::Document::add_term(), Xapian::WritableDatabase::commit(), Xapian::Document::set_data(), and Xapian::Internal::str().
Referenced by DEFINE_TESTCASE().