aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-11-07 15:53:17 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-11-07 19:47:47 +0000
commit1c4d2fd8baab15b998de17afa6db4f4da330e020 (patch)
treeda18e83d923a7c0423dd665d63f604755e35acc8 /searchlib/src/tests
parent1e8cf6c828048d8ad6d3a0e8c663b9a76db59d19 (diff)
Sameelement behaves like an and with extra constraints.
So it should behave the sameway during fetchPostings too.
Diffstat (limited to 'searchlib/src/tests')
-rw-r--r--searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp4
-rw-r--r--searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp2
-rw-r--r--searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp2
-rw-r--r--searchlib/src/tests/queryeval/equiv/equiv_test.cpp10
-rw-r--r--searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp11
-rw-r--r--searchlib/src/tests/queryeval/same_element/same_element_test.cpp7
-rw-r--r--searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp12
-rw-r--r--searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp2
-rw-r--r--searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp4
9 files changed, 27 insertions, 27 deletions
diff --git a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp
index 4ec73a1d313..16597b8b615 100644
--- a/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp
+++ b/searchlib/src/tests/attribute/searchable/attribute_weighted_set_blueprint_test.cpp
@@ -109,7 +109,7 @@ struct WS {
FieldSpecList fields;
fields.add(FieldSpec(field, fieldId, handle, ac.getAttribute(field)->getIsFilter()));
queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node);
- bp->fetchPostings(queryeval::ExecuteInfo::create(strict));
+ bp->fetchPostings(queryeval::ExecuteInfo::createForTest(strict));
SearchIterator::UP sb = bp->createSearch(*md, strict);
return sb;
}
@@ -125,7 +125,7 @@ struct WS {
FieldSpecList fields;
fields.add(FieldSpec(field, fieldId, handle));
queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node);
- bp->fetchPostings(queryeval::ExecuteInfo::create(strict));
+ bp->fetchPostings(queryeval::ExecuteInfo::createForTest(strict));
SearchIterator::UP sb = bp->createSearch(*md, strict);
FakeResult result;
sb->initRange(1, 10);
diff --git a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
index 7a8250a2e16..a663944938c 100644
--- a/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
+++ b/searchlib/src/tests/queryeval/blueprint/intermediate_blueprints_test.cpp
@@ -122,7 +122,7 @@ TEST("test And propagates updated histestimate") {
bp.addChild(ap(MyLeafSpec(2000).create<RememberExecuteInfo>()->setSourceId(2)));
bp.optimize_self();
bp.setDocIdLimit(5000);
- bp.fetchPostings(ExecuteInfo::create(true));
+ bp.fetchPostings(ExecuteInfo::TRUE);
EXPECT_EQUAL(3u, bp.childCnt());
for (uint32_t i = 0; i < bp.childCnt(); i++) {
const RememberExecuteInfo & child = dynamic_cast<const RememberExecuteInfo &>(bp.getChild(i));
diff --git a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
index 4305f7da116..1538a9ce0df 100644
--- a/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
+++ b/searchlib/src/tests/queryeval/dot_product/dot_product_test.cpp
@@ -73,7 +73,7 @@ struct DP {
FieldSpecList fields;
fields.add(FieldSpec(field, fieldId, handle, field_is_filter));
queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP sb = bp->createSearch(*md, strict);
EXPECT_TRUE(dynamic_cast<DotProductSearch*>(sb.get()) != 0);
sb->initFullRange();
diff --git a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp
index 9b74f8a650f..c570c06a60b 100644
--- a/searchlib/src/tests/queryeval/equiv/equiv_test.cpp
+++ b/searchlib/src/tests/queryeval/equiv/equiv_test.cpp
@@ -1,12 +1,14 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include <vespa/log/log.h>
-LOG_SETUP("equiv_test");
+
#include <vespa/searchlib/queryeval/leaf_blueprints.h>
#include <vespa/searchlib/queryeval/intermediate_blueprints.h>
#include <vespa/searchlib/queryeval/equiv_blueprint.h>
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/log/log.h>
+LOG_SETUP("equiv_test");
+
using namespace search::queryeval;
using search::fef::MatchData;
using search::fef::MatchDataLayout;
@@ -17,7 +19,7 @@ using search::fef::FieldPositionsIterator;
class EquivTest : public ::testing::Test {
protected:
EquivTest();
- ~EquivTest();
+ ~EquivTest() override;
void test_equiv(bool strict, bool unpack_normal_features, bool unpack_interleaved_features);
};
@@ -57,7 +59,7 @@ EquivTest::test_equiv(bool strict, bool unpack_normal_features, bool unpack_inte
data.setNeedNormalFeatures(unpack_normal_features);
data.setNeedInterleavedFeatures(unpack_interleaved_features);
}
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
diff --git a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp
index 3bfdcd21ce6..8ddac327643 100644
--- a/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp
+++ b/searchlib/src/tests/queryeval/fake_searchable/fake_searchable_test.cpp
@@ -6,7 +6,6 @@
#include <vespa/searchlib/queryeval/fake_requestcontext.h>
#include <vespa/searchlib/queryeval/blueprint.h>
#include <vespa/searchlib/query/tree/intermediatenodes.h>
-#include <vespa/searchlib/query/tree/termnodes.h>
#include <vespa/searchlib/query/tree/simplequery.h>
#include <vespa/searchlib/fef/matchdata.h>
@@ -63,7 +62,7 @@ TEST_F(FakeSearchableTest, require_that_term_search_works) {
bool strict = (i == 0);
SCOPED_TRACE(strict ? "strict" : "non-strict");
MatchData::UP md = MatchData::makeTestInstance(100, 10);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
@@ -117,7 +116,7 @@ TEST_F(FakeSearchableTest, require_that_phrase_search_works) {
bool strict = (i == 0);
SCOPED_TRACE(strict ? "strict" : "non-strict");
MatchData::UP md = MatchData::makeTestInstance(100, 10);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
@@ -168,7 +167,7 @@ TEST_F(FakeSearchableTest, require_that_weigheted_set_search_works) {
bool strict = (i == 0);
SCOPED_TRACE(strict ? "strict" : "non-strict");
MatchData::UP md = MatchData::makeTestInstance(100, 10);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
@@ -239,7 +238,7 @@ TEST_F(FakeSearchableTest, require_that_multi_field_search_works) {
bool strict = (i == 0);
SCOPED_TRACE(strict ? "strict" : "non-strict");
MatchData::UP md = MatchData::makeTestInstance(100, 10);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
@@ -323,7 +322,7 @@ TEST_F(FakeSearchableTest, require_that_phrase_with_empty_child_works) {
bool strict = (i == 0);
SCOPED_TRACE(strict ? "strict" : "non-strict");
MatchData::UP md = MatchData::makeTestInstance(100, 10);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
diff --git a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp
index 7c5a4648925..d05e6c8e4f4 100644
--- a/searchlib/src/tests/queryeval/same_element/same_element_test.cpp
+++ b/searchlib/src/tests/queryeval/same_element/same_element_test.cpp
@@ -6,7 +6,6 @@
#include <vespa/searchlib/queryeval/simpleresult.h>
#include <vespa/searchlib/queryeval/same_element_blueprint.h>
#include <vespa/searchlib/queryeval/same_element_search.h>
-#include <vespa/searchlib/queryeval/emptysearch.h>
#include <vespa/searchcommon/attribute/i_search_context.h>
#include <vespa/searchlib/attribute/searchcontextelementiterator.h>
#include <vespa/vespalib/test/insertion_operators.h>
@@ -48,7 +47,7 @@ std::unique_ptr<SameElementBlueprint> make_blueprint(const std::vector<FakeResul
Blueprint::UP finalize(Blueprint::UP bp, bool strict) {
Blueprint::UP result = Blueprint::optimize(std::move(bp));
- result->fetchPostings(ExecuteInfo::create(strict));
+ result->fetchPostings(ExecuteInfo::createForTest(strict));
result->freeze();
return result;
}
@@ -87,7 +86,7 @@ TEST("require that matching elements can be identified") {
auto md = make_match_data();
auto search = bp->createSearch(*md, false);
search->initRange(1, 1000);
- SameElementSearch *se = dynamic_cast<SameElementSearch*>(search.get());
+ auto *se = dynamic_cast<SameElementSearch*>(search.get());
ASSERT_TRUE(se != nullptr);
TEST_DO(verify_elements(*se, 5, {3, 7}));
TEST_DO(verify_elements(*se, 10, {}));
@@ -148,7 +147,7 @@ TEST("require that attribute iterators are wrapped for element unpacking") {
auto bp = finalize(make_blueprint({a,b}, true), true);
auto md = make_match_data();
auto search = bp->createSearch(*md, false);
- SameElementSearch *se = dynamic_cast<SameElementSearch*>(search.get());
+ auto *se = dynamic_cast<SameElementSearch*>(search.get());
ASSERT_TRUE(se != nullptr);
ASSERT_EQUAL(se->children().size(), 2u);
EXPECT_TRUE(dynamic_cast<SearchContextElementIterator*>(se->children()[0].get()) != nullptr);
diff --git a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
index 29d4dd2c457..cbe497d6363 100644
--- a/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
+++ b/searchlib/src/tests/queryeval/simple_phrase/simple_phrase_test.cpp
@@ -36,7 +36,7 @@ struct MyTerm : public search::queryeval::SimpleLeafBlueprint {
setEstimate(HitEstimate(hits, (hits == 0)));
}
SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &, bool) const override {
- return SearchIterator::UP();
+ return {};
}
SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override {
return create_default_filter(strict, constraint);
@@ -143,13 +143,13 @@ public:
void
fetchPostings(bool useBlueprint)
{
- ExecuteInfo execInfo = ExecuteInfo::create(_strict);
+ ExecuteInfo execInfo = ExecuteInfo::createForTest(_strict);
if (useBlueprint) {
_phrase.fetchPostings(execInfo);
return;
}
- for (size_t i = 0; i < _children.size(); ++i) {
- _children[i]->fetchPostings(execInfo);
+ for (const auto & i : _children) {
+ i->fetchPostings(execInfo);
}
}
@@ -167,8 +167,8 @@ public:
childMatch.add(child_term_field_match_data);
}
SimplePhraseSearch::Children children;
- for (size_t i = 0; i < _children.size(); ++i) {
- children.push_back(_children[i]->createSearch(*_md, _strict));
+ for (const auto & i : _children) {
+ children.push_back(i->createSearch(*_md, _strict));
}
search = std::make_unique<SimplePhraseSearch>(std::move(children),
MatchData::UP(), childMatch, _order,
diff --git a/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp
index 77c9e1a8039..bb2e559106f 100644
--- a/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp
+++ b/searchlib/src/tests/queryeval/sourceblender/sourceblender_test.cpp
@@ -74,7 +74,7 @@ TEST("test strictness") {
blend_b->addChild(std::move(a_b));
blend_b->addChild(std::move(b_b));
Blueprint::UP bp(blend_b);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
SearchIterator::UP search = bp->createSearch(*md, strict);
search->initFullRange();
SearchIterator &blend = *search;
diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
index 2f3f0eb7392..fed4e7c9bbd 100644
--- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
+++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
@@ -68,7 +68,7 @@ struct WS {
FieldSpecList fields;
fields.add(FieldSpec(field, fieldId, handle));
auto bp = searchable.createBlueprint(requestContext, fields, *node);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
auto sb = bp->createSearch(*md, strict);
return (dynamic_cast<WeightedSetTermSearch*>(sb.get()) != nullptr);
}
@@ -83,7 +83,7 @@ struct WS {
FieldSpecList fields;
fields.add(FieldSpec(field, fieldId, handle, field_is_filter));
auto bp = searchable.createBlueprint(requestContext, fields, *node);
- bp->fetchPostings(ExecuteInfo::create(strict));
+ bp->fetchPostings(ExecuteInfo::createForTest(strict));
auto sb = bp->createSearch(*md, strict);
sb->initFullRange();
FakeResult result;