aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton')
-rw-r--r--searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp6
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp21
-rw-r--r--searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp5
-rw-r--r--searchcore/src/tests/proton/index/fusionrunner_test.cpp5
-rw-r--r--searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp14
-rw-r--r--searchcore/src/tests/proton/matching/query_test.cpp40
-rw-r--r--searchcore/src/tests/proton/matching/querynodes_test.cpp5
7 files changed, 52 insertions, 44 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
index c9951f0b60e..c1560d5e51c 100644
--- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
@@ -187,10 +187,10 @@ assertWhiteList(const SimpleResult &exp, Blueprint::UP whiteListBlueprint, bool
{
MatchDataLayout mdl;
MatchData::UP md = mdl.createMatchData();
- whiteListBlueprint->fetchPostings(search::queryeval::ExecuteInfo::createForTest(strict));
- whiteListBlueprint->setDocIdLimit(docIdLimit);
+ whiteListBlueprint->basic_plan(strict, docIdLimit);
+ whiteListBlueprint->fetchPostings(search::queryeval::ExecuteInfo::FULL);
- SearchIterator::UP sb = whiteListBlueprint->createSearch(*md, strict);
+ SearchIterator::UP sb = whiteListBlueprint->createSearch(*md);
SimpleResult act;
act.searchStrict(*sb, docIdLimit);
EXPECT_EQ(exp, act);
diff --git a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
index 4aefa10f5f2..19af5ca239a 100644
--- a/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/lid_allocator/lid_allocator_test.cpp
@@ -103,20 +103,20 @@ protected:
return result;
}
- Blueprint::UP make_whitelist_blueprint(uint32_t docid_limit) {
+ Blueprint::UP make_whitelist_blueprint(bool strict, uint32_t docid_limit) {
auto blueprint = _allocator.createWhiteListBlueprint();
- blueprint->setDocIdLimit(docid_limit);
+ blueprint->basic_plan(strict, docid_limit);
return blueprint;
}
SimpleResult get_active_lids_in_search_iterator(uint32_t docid_limit, bool filter) {
- auto blueprint = make_whitelist_blueprint(docid_limit);
+ auto blueprint = make_whitelist_blueprint(true, docid_limit);
std::unique_ptr<SearchIterator> iterator;
MatchData md(MatchData::params());
if (filter) {
- iterator = blueprint->createFilterSearch(true, Blueprint::FilterConstraint::UPPER_BOUND);
+ iterator = blueprint->createFilterSearch(Blueprint::FilterConstraint::UPPER_BOUND);
} else {
- iterator = blueprint->createSearch(md, true);
+ iterator = blueprint->createSearch(md);
}
SimpleResult res;
res.search(*iterator, docid_limit);
@@ -124,8 +124,8 @@ protected:
}
Trinary filter_search_iterator_matches_any(uint32_t docid_limit) {
- auto blueprint = make_whitelist_blueprint(docid_limit);
- auto iterator = blueprint->createFilterSearch(true, Blueprint::FilterConstraint::UPPER_BOUND);
+ auto blueprint = make_whitelist_blueprint(true, docid_limit);
+ auto iterator = blueprint->createFilterSearch(Blueprint::FilterConstraint::UPPER_BOUND);
return iterator->matches_any();
}
@@ -180,10 +180,9 @@ TEST_F(LidAllocatorTest, whitelist_blueprint_can_maximize_relative_estimate)
activate_lids({ 1, 2, 3, 4 }, true);
// the number of hits are overestimated based on the number of
// documents that could be active (100 in this test fixture)
- // NOTE: optimize must be called in order to calculate the relative estimate
- EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(1000))->estimate(), 0.1);
- EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(200))->estimate(), 0.5);
- EXPECT_EQ(Blueprint::optimize(make_whitelist_blueprint(5))->estimate(), 1.0);
+ EXPECT_EQ(make_whitelist_blueprint(true, 1000)->estimate(), 0.1);
+ EXPECT_EQ(make_whitelist_blueprint(true, 200)->estimate(), 0.5);
+ EXPECT_EQ(make_whitelist_blueprint(true, 5)->estimate(), 1.0);
}
class LidAllocatorPerformanceTest : public LidAllocatorTest,
diff --git a/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp
index ff740dd8801..69f95ec7243 100644
--- a/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp
+++ b/searchcore/src/tests/proton/feed_and_search/feed_and_search_test.cpp
@@ -100,8 +100,9 @@ testSearch(Searchable &source, const string &term, uint32_t doc_id)
SimpleStringTerm node(term, field_name, 0, search::query::Weight(0));
Blueprint::UP result = source.createBlueprint(requestContext,
FieldSpecList().add(FieldSpec(field_name, 0, handle)), node);
- result->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
- SearchIterator::UP search_iterator = result->createSearch(*match_data, true);
+ result->basic_plan(true, 1000);
+ result->fetchPostings(search::queryeval::ExecuteInfo::FULL);
+ SearchIterator::UP search_iterator = result->createSearch(*match_data);
search_iterator->initFullRange();
ASSERT_TRUE(search_iterator.get());
ASSERT_TRUE(search_iterator->seek(doc_id));
diff --git a/searchcore/src/tests/proton/index/fusionrunner_test.cpp b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
index dd6e8fa1c4c..c96af8e3539 100644
--- a/searchcore/src/tests/proton/index/fusionrunner_test.cpp
+++ b/searchcore/src/tests/proton/index/fusionrunner_test.cpp
@@ -240,8 +240,9 @@ FusionRunnerTest::checkResults(uint32_t fusion_id, const uint32_t *ids, size_t s
search::queryeval::Searchable &searchable = disk_index;
SimpleStringTerm node(term, field_name, fieldId, search::query::Weight(0));
Blueprint::UP blueprint = searchable.createBlueprint(requestContext, fields, node);
- blueprint->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
- SearchIterator::UP search = blueprint->createSearch(*match_data, true);
+ blueprint->basic_plan(true, 1000);
+ blueprint->fetchPostings(search::queryeval::ExecuteInfo::FULL);
+ SearchIterator::UP search = blueprint->createSearch(*match_data);
search->initFullRange();
for (size_t i = 0; i < size; ++i) {
EXPECT_TRUE(search->seek(ids[i]));
diff --git a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
index 5e10d12e16f..6f398469fd3 100644
--- a/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
+++ b/searchcore/src/tests/proton/matching/match_phase_limiter/match_phase_limiter_test.cpp
@@ -78,18 +78,18 @@ struct MockBlueprint : SimpleLeafBlueprint {
search::queryeval::FlowStats calculate_flow_stats(uint32_t docid_limit) const override {
return default_flow_stats(docid_limit, 756, 0);
}
- SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda, bool strict) const override
+ SearchIterator::UP createLeafSearch(const TermFieldMatchDataArray &tfmda) const override
{
if (postings_fetched) {
- EXPECT_EQUAL(postings_strict, strict);
+ EXPECT_EQUAL(postings_strict, strict());
}
- return std::make_unique<MockSearch>(spec, term, strict, tfmda, postings_fetched);
+ return std::make_unique<MockSearch>(spec, term, strict(), tfmda, postings_fetched);
}
- SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override {
- return create_default_filter(strict, constraint);
+ SearchIteratorUP createFilterSearch(FilterConstraint constraint) const override {
+ return create_default_filter(constraint);
}
- void fetchPostings(const search::queryeval::ExecuteInfo &execInfo) override {
- postings_strict = execInfo.is_strict();
+ void fetchPostings(const search::queryeval::ExecuteInfo &) override {
+ postings_strict = strict();
postings_fetched = true;
}
};
diff --git a/searchcore/src/tests/proton/matching/query_test.cpp b/searchcore/src/tests/proton/matching/query_test.cpp
index e798f87dd12..83b7e10c7a8 100644
--- a/searchcore/src/tests/proton/matching/query_test.cpp
+++ b/searchcore/src/tests/proton/matching/query_test.cpp
@@ -145,9 +145,9 @@ Fixture::getIterator(Node &node, ISearchContext &context) {
_match_data = mdl.createMatchData();
_blueprint = BlueprintBuilder::build(_requestContext, node, context);
-
- _blueprint->fetchPostings(ExecuteInfo::TRUE);
- SearchIterator::UP search(_blueprint->createSearch(*_match_data, true));
+ _blueprint->basic_plan(true, 1000);
+ _blueprint->fetchPostings(ExecuteInfo::FULL);
+ SearchIterator::UP search(_blueprint->createSearch(*_match_data));
search->initFullRange();
return search;
}
@@ -652,8 +652,8 @@ TEST("requireThatQueryGluesEverythingTogether") {
MatchData::UP md = mdl.createMatchData();
EXPECT_EQUAL(1u, md->getNumTermFields());
- query.optimize(true);
- query.fetchPostings(ExecuteInfo::TRUE);
+ query.optimize(true, true);
+ query.fetchPostings(ExecuteInfo::FULL);
SearchIterator::UP search = query.createSearch(*md);
ASSERT_TRUE(search);
}
@@ -685,7 +685,8 @@ checkQueryAddsLocation(const string &loc_in, const string &loc_out) {
MatchData::UP md = mdl.createMatchData();
EXPECT_EQUAL(2u, md->getNumTermFields());
- query.fetchPostings(ExecuteInfo::TRUE);
+ // query.optimize(true, true);
+ query.fetchPostings(ExecuteInfo::FULL);
SearchIterator::UP search = query.createSearch(*md);
ASSERT_TRUE(search);
if (!EXPECT_NOT_EQUAL(string::npos, search->asString().find(loc_out))) {
@@ -788,15 +789,20 @@ TEST("requireThatFakeFieldSearchDumpsDiffer")
Blueprint::UP l3(a.createBlueprint(requestContext, fields2, n3)); // field
Blueprint::UP l4(b.createBlueprint(requestContext, fields1, n1)); // tag
- l1->fetchPostings(ExecuteInfo::TRUE);
- l2->fetchPostings(ExecuteInfo::TRUE);
- l3->fetchPostings(ExecuteInfo::TRUE);
- l4->fetchPostings(ExecuteInfo::TRUE);
-
- SearchIterator::UP s1(l1->createSearch(*match_data, true));
- SearchIterator::UP s2(l2->createSearch(*match_data, true));
- SearchIterator::UP s3(l3->createSearch(*match_data, true));
- SearchIterator::UP s4(l4->createSearch(*match_data, true));
+ l1->basic_plan(true, 1000);
+ l2->basic_plan(true, 1000);
+ l3->basic_plan(true, 1000);
+ l4->basic_plan(true, 1000);
+
+ l1->fetchPostings(ExecuteInfo::FULL);
+ l2->fetchPostings(ExecuteInfo::FULL);
+ l3->fetchPostings(ExecuteInfo::FULL);
+ l4->fetchPostings(ExecuteInfo::FULL);
+
+ SearchIterator::UP s1(l1->createSearch(*match_data));
+ SearchIterator::UP s2(l2->createSearch(*match_data));
+ SearchIterator::UP s3(l3->createSearch(*match_data));
+ SearchIterator::UP s4(l4->createSearch(*match_data));
EXPECT_NOT_EQUAL(s1->asString(), s2->asString());
EXPECT_NOT_EQUAL(s1->asString(), s3->asString());
@@ -904,8 +910,8 @@ TEST("requireThatWhiteListBlueprintCanBeUsed")
query.reserveHandles(requestContext, context, mdl);
MatchData::UP md = mdl.createMatchData();
- query.optimize(true);
- query.fetchPostings(ExecuteInfo::TRUE);
+ query.optimize(true, true);
+ query.fetchPostings(ExecuteInfo::FULL);
SearchIterator::UP search = query.createSearch(*md);
SimpleResult exp = SimpleResult().addHit(1).addHit(5).addHit(7).addHit(11);
SimpleResult act;
diff --git a/searchcore/src/tests/proton/matching/querynodes_test.cpp b/searchcore/src/tests/proton/matching/querynodes_test.cpp
index f3c986d7fe4..64c6870499c 100644
--- a/searchcore/src/tests/proton/matching/querynodes_test.cpp
+++ b/searchcore/src/tests/proton/matching/querynodes_test.cpp
@@ -205,8 +205,9 @@ public:
MatchData::UP match_data = mdl.createMatchData();
Blueprint::UP blueprint = BlueprintBuilder::build(requestContext, node, context);
- blueprint->fetchPostings(search::queryeval::ExecuteInfo::TRUE);
- return blueprint->createSearch(*match_data, true)->asString();
+ blueprint->basic_plan(true, 1000);
+ blueprint->fetchPostings(search::queryeval::ExecuteInfo::FULL);
+ return blueprint->createSearch(*match_data)->asString();
}
template <typename Tag> string getIteratorAsString();