summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2019-11-12 15:14:49 +0000
committerHenning Baldersheim <balder@oath.com>2019-11-12 15:14:49 +0000
commit6129472bd9b6d1b82ef5ebb7c9253adef4c20284 (patch)
treede58b8884509fc6294b222c6f544142ac785c1e5 /document
parentc8fc3b811c80a1900e451df4ada2981787c76d5f (diff)
And then we can also remove the exponential factor.......
Diffstat (limited to 'document')
-rw-r--r--document/src/vespa/document/select/resultlist.cpp32
1 files changed, 25 insertions, 7 deletions
diff --git a/document/src/vespa/document/select/resultlist.cpp b/document/src/vespa/document/select/resultlist.cpp
index 60361223a64..cd633004d26 100644
--- a/document/src/vespa/document/select/resultlist.cpp
+++ b/document/src/vespa/document/select/resultlist.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "resultlist.h"
+#include <vespa/vespalib/stllike/hash_set.h>
#include <ostream>
namespace document::select {
@@ -96,39 +97,56 @@ ResultList::combineVariables(
ResultList
ResultList::operator&&(const ResultList& other) const
{
- ResultList result;
+ ResultList results;
// TODO: optimize
+ vespalib::hash_set<uint32_t> resultForNoVariables;
for (const auto & it : _results) {
for (const auto & it2 : other._results) {
fieldvalue::VariableMap vars = it.first;
if (combineVariables(vars, it2.first)) {
- result.add(vars, *it.second && *it2.second);
+ const Result & result = *it.second && *it2.second;
+ if (vars.empty()) {
+ resultForNoVariables.insert(result.toEnum());
+ } else {
+ results.add(vars, result);
+ }
}
}
}
+ for (uint32_t result : resultForNoVariables) {
+ results.add(fieldvalue::VariableMap(), Result::fromEnum(result));
+ }
- return result;
+ return results;
}
ResultList
ResultList::operator||(const ResultList& other) const
{
- ResultList result;
+ ResultList results;
// TODO: optimize
+ vespalib::hash_set<uint32_t> resultForNoVariables;
for (const auto & it : _results) {
for (const auto & it2 : other._results) {
fieldvalue::VariableMap vars = it.first;
-
if (combineVariables(vars, it2.first)) {
- result.add(vars, *it.second || *it2.second);
+ const Result & result = *it.second || *it2.second;
+ if (vars.empty()) {
+ resultForNoVariables.insert(result.toEnum());
+ } else {
+ results.add(vars, result);
+ }
}
}
}
+ for (uint32_t result : resultForNoVariables) {
+ results.add(fieldvalue::VariableMap(), Result::fromEnum(result));
+ }
- return result;
+ return results;
}
ResultList