diff options
author | Henning Baldersheim <balder@oath.com> | 2019-11-12 14:54:30 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2019-11-12 14:54:30 +0000 |
commit | c8fc3b811c80a1900e451df4ada2981787c76d5f (patch) | |
tree | 21645afbf83171eff5f8e72b7a8744cf7410f69b /document | |
parent | 028207b297de7b38e3b73350e3d20e2d9b8bfa30 (diff) |
Limit number of items in list to number of unique items for the empty no variables map.
Diffstat (limited to 'document')
-rw-r--r-- | document/src/vespa/document/select/value.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/document/src/vespa/document/select/value.cpp b/document/src/vespa/document/select/value.cpp index a33ee27afdb..064598bf2d4 100644 --- a/document/src/vespa/document/select/value.cpp +++ b/document/src/vespa/document/select/value.cpp @@ -3,6 +3,7 @@ #include "value.h" #include "operator.h" #include <vespa/document/fieldvalue/fieldvalue.h> +#include <vespa/vespalib/stllike/hash_set.h> #include <ostream> namespace document::select { @@ -408,10 +409,18 @@ ArrayValue::doCompare(const Value& value, const Predicate& cmp) const } else { ResultList results; + vespalib::hash_set<uint32_t> resultForNoVariables; // If comparing with other value, must match one. - for (uint32_t i=0; i<_values.size(); ++i) { - results.add(_values[i].first, - cmp(*_values[i].second, value).combineResults()); + for (const auto & item : _values) { + const Result & result = cmp(*item.second, value).combineResults(); + if (item.first.empty()) { + resultForNoVariables.insert(result.toEnum()); + } else { + results.add(item.first, result); + } + } + for (uint32_t result : resultForNoVariables) { + results.add(fieldvalue::VariableMap(), Result::fromEnum(result)); } return results; } |