aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp')
-rw-r--r--searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp61
1 files changed, 22 insertions, 39 deletions
diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
index 1bc87ef0da5..e8dbaefc2ba 100644
--- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
+++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
@@ -1,13 +1,13 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchcommon/attribute/search_context_params.h>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/imported_search_context.h>
#include <vespa/searchlib/fef/termfieldmatchdata.h>
#include <vespa/searchlib/query/query_term_ucs4.h>
#include <vespa/searchlib/queryeval/simpleresult.h>
#include <vespa/searchlib/test/imported_attribute_fixture.h>
#include <vespa/vespalib/test/insertion_operators.h>
-#include <vespa/searchlib/queryeval/executeinfo.h>
namespace search::attribute {
@@ -18,30 +18,31 @@ using vespalib::Trinary;
struct Fixture : ImportedAttributeFixture {
- Fixture(bool useSearchCache = false, FastSearchConfig fastSearch = FastSearchConfig::Default)
- : ImportedAttributeFixture(useSearchCache, fastSearch)
- {}
+ Fixture(bool useSearchCache = false) : ImportedAttributeFixture(useSearchCache) {}
- std::unique_ptr<ImportedSearchContext>
- create_context(std::unique_ptr<QueryTermSimple> term) {
+ std::unique_ptr<ImportedSearchContext> create_context(std::unique_ptr<QueryTermSimple> term) {
return std::make_unique<ImportedSearchContext>(std::move(term), SearchContextParams(), *imported_attr, *target_attr);
}
- std::unique_ptr<SearchIterator>
- create_iterator(ImportedSearchContext& ctx,TermFieldMatchData& match,bool strict) {
+ std::unique_ptr<SearchIterator> create_iterator(
+ ImportedSearchContext& ctx,
+ TermFieldMatchData& match,
+ bool strict) {
auto iter = ctx.createIterator(&match, strict);
assert(iter.get() != nullptr);
iter->initRange(DocId(1), reference_attr->getNumDocs());
return iter;
}
- std::unique_ptr<SearchIterator>
- create_non_strict_iterator(ImportedSearchContext& ctx, TermFieldMatchData& match) {
+ std::unique_ptr<SearchIterator> create_non_strict_iterator(
+ ImportedSearchContext& ctx,
+ TermFieldMatchData& match) {
return create_iterator(ctx, match, false);
}
- std::unique_ptr<SearchIterator>
- create_strict_iterator(ImportedSearchContext& ctx,TermFieldMatchData& match) {
+ std::unique_ptr<SearchIterator> create_strict_iterator(
+ ImportedSearchContext& ctx,
+ TermFieldMatchData& match) {
return create_iterator(ctx, match, true);
}
@@ -209,31 +210,13 @@ TEST_F("Non-strict iterator unpacks target match data for weighted set hit", Wse
TEST_F("Strict iterator is marked as strict", Fixture) {
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
EXPECT_TRUE(iter->is_strict() == Trinary::True); // No EXPECT_EQUALS printing of Trinary...
}
-TEST_F("Non-strict blueprint with high hit rate is strict", Fixture(false, FastSearchConfig::ExplicitlyEnabled)) {
- auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.02));
- TermFieldMatchData match;
- auto iter = f.create_iterator(*ctx, match, false);
-
- EXPECT_TRUE(iter->is_strict() == Trinary::True);
-}
-
-TEST_F("Non-strict blueprint with low hit rate is non-strict", Fixture(false, FastSearchConfig::ExplicitlyEnabled)) {
- auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::create(false, 0.01));
- TermFieldMatchData match;
- auto iter = f.create_iterator(*ctx, match, false);
-
- EXPECT_TRUE(iter->is_strict() == Trinary::False);
-}
-
struct SingleValueFixture : Fixture {
SingleValueFixture() {
reset_with_single_value_reference_mappings<IntegerAttribute, int32_t>(
@@ -249,7 +232,7 @@ struct SingleValueFixture : Fixture {
TEST_F("Strict iterator seeks to first available hit LID", SingleValueFixture) {
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
@@ -275,7 +258,7 @@ TEST_F("Strict iterator seeks to first available hit LID", SingleValueFixture) {
TEST_F("Strict iterator unpacks target match data for single value hit", SingleValueFixture) {
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
@@ -287,7 +270,7 @@ TEST_F("Strict iterator unpacks target match data for single value hit", SingleV
TEST_F("Strict iterator unpacks target match data for array hit", ArrayValueFixture) {
auto ctx = f.create_context(word_term("1234"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
@@ -299,7 +282,7 @@ TEST_F("Strict iterator unpacks target match data for array hit", ArrayValueFixt
TEST_F("Strict iterator unpacks target match data for weighted set hit", WsetValueFixture) {
auto ctx = f.create_context(word_term("foo"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
@@ -310,7 +293,7 @@ TEST_F("Strict iterator unpacks target match data for weighted set hit", WsetVal
TEST_F("Strict iterator handles seek outside of LID space", ArrayValueFixture) {
auto ctx = f.create_context(word_term("1234"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
@@ -342,7 +325,7 @@ TEST_F("matches(weight) performs GID mapping and forwards to target attribute",
TEST_F("Multiple iterators can be created from the same context", SingleValueFixture) {
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match1;
auto iter1 = f.create_strict_iterator(*ctx, match1);
@@ -397,7 +380,7 @@ TEST_F("Bit vector from search cache is used if found", SearchCacheFixture)
f.imported_attr->getSearchCache()->insert("5678",
makeSearchCacheEntry({2, 6}, f.get_imported_attr()->getNumDocs()));
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
TEST_DO(f.assertSearch({2, 6}, *iter)); // Note: would be {3, 5} if cache was not used
@@ -416,7 +399,7 @@ TEST_F("Entry is inserted into search cache if bit vector posting list is used",
{
EXPECT_EQUAL(0u, f.imported_attr->getSearchCache()->size());
auto ctx = f.create_context(word_term("5678"));
- ctx->fetchPostings(queryeval::ExecuteInfo::TRUE);
+ ctx->fetchPostings(true);
TermFieldMatchData match;
auto iter = f.create_strict_iterator(*ctx, match);
TEST_DO(f.assertSearch({3, 5}, *iter));