diff options
author | Geir Storli <geirst@verizonmedia.com> | 2020-01-28 15:55:14 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2020-01-28 15:55:14 +0000 |
commit | 671b81cb952aa19704e9c50d93f083066c528810 (patch) | |
tree | 6fa041c08c6e24d03151d79beb4091c9a73cbdcb /searchlib/src/tests/queryeval/queryeval.cpp | |
parent | d47dc1ca38ff5c0611923acfbac8d50ae5ea7807 (diff) |
Correctly handle search for "false" in the underlying search context of singleboolattribute.
This code path is used when searching on an imported bool attribute (from a parent document),
combined with other query terms (e.g. under an AND) such that the search iterator for the imported bool attributes is not strict.
In this case the underlying search context is used, and search for "false" would previously return all "true" documents instead.
Diffstat (limited to 'searchlib/src/tests/queryeval/queryeval.cpp')
-rw-r--r-- | searchlib/src/tests/queryeval/queryeval.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/searchlib/src/tests/queryeval/queryeval.cpp b/searchlib/src/tests/queryeval/queryeval.cpp index 32dc9b1fa7e..5601baa9113 100644 --- a/searchlib/src/tests/queryeval/queryeval.cpp +++ b/searchlib/src/tests/queryeval/queryeval.cpp @@ -346,29 +346,12 @@ public: (void) tfmda; return _sc->createIterator(&_tfmd, strict); } - const search::AttributeVector::SearchContext & getSearchContext() const { return *_sc; } private: search::SingleBoolAttribute _a; search::AttributeVector::SearchContext::UP _sc; mutable TermFieldMatchData _tfmd; }; -TEST("test bool attribute searchcontext") { - SimpleResult a; - a.addHit(5).addHit(17).addHit(30); - auto bp = std::make_unique<DummySingleValueBitNumericAttributeBlueprint>(a); - const search::AttributeVector::SearchContext & sc = bp->getSearchContext(); - EXPECT_FALSE(sc.matches(7)); - EXPECT_TRUE(sc.matches(17)); - int32_t weight(0); - EXPECT_FALSE(sc.matches(7, weight)); - EXPECT_EQUAL(0, weight); - EXPECT_TRUE(sc.matches(17, weight)); - EXPECT_EQUAL(1, weight); - EXPECT_FALSE(sc.matches(27, weight)); - EXPECT_EQUAL(0, weight); -} - TEST("testAndNot") { { |