diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-23 12:54:31 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-04-23 12:54:31 +0000 |
commit | 2c5170d30a0dd54eef9e0bb1709823b68c14e0f3 (patch) | |
tree | c01ce4c24ddf8a9298cab7e37034304608fbe5da /searchlib/src | |
parent | c806cd7badce15d86b9b967584053af4e02cb39c (diff) |
Return true from AndNot when no children at all.
Diffstat (limited to 'searchlib/src')
-rw-r--r-- | searchlib/src/vespa/searchlib/query/streaming/query.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/searchlib/src/vespa/searchlib/query/streaming/query.cpp b/searchlib/src/vespa/searchlib/query/streaming/query.cpp index 62d8572fbf3..a189b5cbfab 100644 --- a/searchlib/src/vespa/searchlib/query/streaming/query.cpp +++ b/searchlib/src/vespa/searchlib/query/streaming/query.cpp @@ -137,9 +137,10 @@ AndQueryNode::evaluate() const bool AndNotQueryNode::evaluate() const { + if (getChildren().empty()) return true; auto it = getChildren().begin(); auto mt = getChildren().end(); - if ((it != getChildren().end()) && (*it)->evaluate()) { + if ((*it)->evaluate()) { for (++it; it != mt; it++) { if ((*it)->evaluate()) return false; } @@ -182,7 +183,7 @@ SameElementQueryNode::evaluateHits(HitList & hl) const if ( !AndQueryNode::evaluate()) return hl; HitList tmpHL; - const QueryNodeList & children = getChildren(); + const auto & children = getChildren(); unsigned int numFields = children.size(); unsigned int currMatchCount = 0; std::vector<unsigned int> indexVector(numFields, 0); @@ -244,7 +245,7 @@ PhraseQueryNode::evaluateHits(HitList & hl) const if ( ! AndQueryNode::evaluate()) return hl; HitList tmpHL; - const QueryNodeList & children = getChildren(); + const auto & children = getChildren(); unsigned int fullPhraseLen = children.size(); unsigned int currPhraseLen = 0; std::vector<unsigned int> indexVector(fullPhraseLen, 0); |