Limit number of items in list to number of unique items for the empty no variables map.
#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;
}
