aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-01-03 12:18:54 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-01-03 12:18:54 +0000
commit52bd8de700f4bcf6f2efc63c76aaff4317d9af3b (patch)
tree9a8ebbd8a481dc4e917b909fdfd08697639c1ea6 /searchcore
parentdbe3a67718104c4150ae770294c23d8a41f0a16c (diff)
predicate, tensor and reference attributes will not be tried fetched form attributes during selection. Fallback to fetch from document.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp44
1 files changed, 26 insertions, 18 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
index a953d651a33..d007b030e6b 100644
--- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp
@@ -9,15 +9,13 @@
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/attribute/iattributemanager.h>
-#include <vespa/log/log.h>
-LOG_SETUP(".proton.common.cachedselect");
-
namespace proton {
using search::AttributeVector;
using search::AttributeGuard;
using document::select::FieldValueNode;
using search::attribute::CollectionType;
+using search::attribute::BasicType;
using NodeUP = std::unique_ptr<document::select::Node>;
@@ -42,7 +40,7 @@ public:
}
AttrVisitor(const search::IAttributeManager &amgr, CachedSelect::AttributeVectors &attributes);
- ~AttrVisitor();
+ ~AttrVisitor() override;
/*
* Mutate field value nodes representing single value attributes into
@@ -62,7 +60,11 @@ AttrVisitor::AttrVisitor(const search::IAttributeManager &amgr, CachedSelect::At
_complexAttrs(0u)
{}
-AttrVisitor::~AttrVisitor() { }
+AttrVisitor::~AttrVisitor() = default;
+
+bool isSingleValueThatWEHandle(BasicType type) {
+ return (type != BasicType::PREDICATE) && (type != BasicType::TENSOR) && (type != BasicType::REFERENCE);
+}
void
AttrVisitor::visitFieldValueNode(const FieldValueNode &expr)
@@ -83,20 +85,26 @@ AttrVisitor::visitFieldValueNode(const FieldValueNode &expr)
}
std::shared_ptr<search::AttributeVector> av(ag->getSP());
if (av->getCollectionType() == CollectionType::SINGLE) {
- ++_svAttrs;
- AttrMap::iterator it(_amap.find(name));
- uint32_t idx(invalidIdx());
- if (it == _amap.end()) {
- // Allocate new location for guard
- idx = _attributes.size();
- _amap[name] = idx;
- _attributes.push_back(av);
+ if (isSingleValueThatWEHandle(av->getBasicType())) {
+ ++_svAttrs;
+ auto it(_amap.find(name));
+ uint32_t idx(invalidIdx());
+ if (it == _amap.end()) {
+ // Allocate new location for guard
+ idx = _attributes.size();
+ _amap[name] = idx;
+ _attributes.push_back(av);
+ } else {
+ // Already allocated location for guard
+ idx = it->second;
+ }
+ assert(idx != invalidIdx());
+ _valueNode = std::make_unique<AttributeFieldValueNode>(expr.getDocType(), name, av);
} else {
- // Already allocated location for guard
- idx = it->second;
+ ++_complexAttrs;
+ // Don't try to optimize predicate/tensor/reference attributes yet.
+ _valueNode = expr.clone();
}
- assert(idx != invalidIdx());
- _valueNode.reset(new AttributeFieldValueNode(expr.getDocType(), name, av));
} else {
// Don't try to optimize multivalue attribute vectors yet
++_mvAttrs;
@@ -186,7 +194,7 @@ CachedSelect::CachedSelect()
_preDocSelect()
{ }
-CachedSelect::~CachedSelect() { }
+CachedSelect::~CachedSelect() = default;
void
CachedSelect::set(const vespalib::string &selection,