diff options
author | Geir Storli <geirst@verizonmedia.com> | 2019-11-01 08:48:06 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2019-11-01 09:26:50 +0000 |
commit | a98348f736f16506a9e7d5fa80ddb029fd2162c8 (patch) | |
tree | 5e10a92b623a5f154715dd68d05d45d59bb1453d /searchlib/src/tests/attribute/searchable | |
parent | 7274edd73bcbc1956b9956b6d15743a77dae53e9 (diff) |
Fix setup of same element iterator to use the attribute search context from the child blueprint instead of the child search iterator.
This fixes a bug that occurs if the search iterator from a fast-search attribute is a bit vector iterator.
The bit vector iterator doesn't expose the attribute search context, so the setup of the same element iterator
doesn't wrap it into an attribute element iterator that handles finding which elements that match.
The result is that the same element iterator will not match any documents.
Diffstat (limited to 'searchlib/src/tests/attribute/searchable')
-rw-r--r-- | searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp index d0a04e2a007..5d2dad39ed0 100644 --- a/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp +++ b/searchlib/src/tests/attribute/searchable/attributeblueprint_test.cpp @@ -85,7 +85,7 @@ public: constexpr uint32_t DOCID_LIMIT = 3; -bool search(const Node &node, IAttributeManager &attribute_manager) { +bool search(const Node &node, IAttributeManager &attribute_manager, bool expect_attribute_search_context = true) { AttributeContext ac(attribute_manager); FakeRequestContext requestContext(&ac); MatchData::UP md(MatchData::makeTestInstance(1, 1)); @@ -94,6 +94,11 @@ bool search(const Node &node, IAttributeManager &attribute_manager) { ASSERT_TRUE(result.get()); EXPECT_TRUE(!result->getState().estimate().empty); EXPECT_EQUAL(3u, result->getState().estimate().estHits); + if (expect_attribute_search_context) { + EXPECT_TRUE(result->get_attribute_search_context() != nullptr); + } else { + EXPECT_TRUE(result->get_attribute_search_context() == nullptr); + } result->fetchPostings(true); result->setDocIdLimit(DOCID_LIMIT); SearchIterator::UP iterator = result->createSearch(*md, true); @@ -181,13 +186,13 @@ TEST("requireThatLocationTermsWork") { MyAttributeManager attribute_manager = makeAttributeManager(int64_t(0xcc)); SimpleLocationTerm node(Location(Point(10, 10), 3, 0), field, 0, Weight(0)); - EXPECT_TRUE(search(node, attribute_manager)); + EXPECT_TRUE(search(node, attribute_manager, false)); node = SimpleLocationTerm(Location(Point(100, 100), 3, 0), field, 0, Weight(0)); - EXPECT_TRUE(!search(node, attribute_manager)); + EXPECT_TRUE(!search(node, attribute_manager, false)); node = SimpleLocationTerm(Location(Point(13, 13), 4, 0), field, 0, Weight(0)); - EXPECT_TRUE(!search(node, attribute_manager)); + EXPECT_TRUE(!search(node, attribute_manager, false)); node = SimpleLocationTerm(Location(Point(10, 13), 3, 0), field, 0, Weight(0)); - EXPECT_TRUE(search(node, attribute_manager)); + EXPECT_TRUE(search(node, attribute_manager, false)); } TEST("requireThatFastSearchLocationTermsWork") { |