aboutsummaryrefslogtreecommitdiffstats
path: root/streamingvisitors
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-03-16 17:36:04 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-03-16 18:06:45 +0000
commitcea11eaf40659b879d143f99eee2f6b78e427761 (patch)
tree88a81f4697a51d889af52daf1b581eeb3ee6385e /streamingvisitors
parentfd26131762bf938c033178637604df97076ffcdf (diff)
Avoid requiring identifiable for FieldValue
Diffstat (limited to 'streamingvisitors')
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
index cbf58b5313d..80cf0ebc73d 100644
--- a/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/searchvisitor.cpp
@@ -16,6 +16,7 @@
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/size_literals.h>
+#include <vespa/vespalib/util/classname.h>
#include <vespa/fnet/databuffer.h>
#include "matching_elements_filler.h"
@@ -72,7 +73,7 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa
ndt = &cdt->getNestedType();
}
LOG(debug, "Create %s attribute '%s' with data type '%s' (%s)",
- arrayType ? "array" : "weighted set", name.c_str(), ndt->getName().c_str(), fv.getClass().name());
+ arrayType ? "array" : "weighted set", name.c_str(), ndt->getName().c_str(), vespalib::getClassName(fv).c_str());
if (ndt->getId() == DataType::T_BYTE ||
ndt->getId() == DataType::T_INT ||
ndt->getId() == DataType::T_LONG)
@@ -89,7 +90,7 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa
: std::make_shared<search::WeightedSetStringExtAttribute>(name);
} else {
LOG(debug, "Can not make an multivalue attribute out of %s with data type '%s' (%s)",
- name.c_str(), ndt->getName().c_str(), fv.getClass().name());
+ name.c_str(), ndt->getName().c_str(), vespalib::getClassName(fv).c_str());
}
return AttributeVector::SP();
}
@@ -97,15 +98,15 @@ createMultiValueAttribute(const vespalib::string & name, const document::FieldVa
AttributeVector::SP
createAttribute(const vespalib::string & name, const document::FieldValue & fv)
{
- LOG(debug, "Create single value attribute '%s' with value type '%s'", name.c_str(), fv.getClass().name());
- if (fv.inherits(document::ByteFieldValue::classId) || fv.inherits(document::IntFieldValue::classId) || fv.inherits(document::LongFieldValue::classId)) {
+ LOG(debug, "Create single value attribute '%s' with value type '%s'", name.c_str(), vespalib::getClassName(fv).c_str());
+ if (fv.isA(document::FieldValue::Type::BYTE) || fv.isA(document::FieldValue::Type::INT) || fv.isA(document::FieldValue::Type::LONG)) {
return std::make_shared<search::SingleIntegerExtAttribute>(name);
- } else if (fv.inherits(document::DoubleFieldValue::classId) || fv.inherits(document::FloatFieldValue::classId)) {
+ } else if (fv.isA(document::FieldValue::Type::DOUBLE) || fv.isA(document::FieldValue::Type::FLOAT)) {
return std::make_shared<search::SingleFloatExtAttribute>(name);
- } else if (fv.inherits(document::StringFieldValue::classId)) {
+ } else if (fv.isA(document::FieldValue::Type::STRING)) {
return std::make_shared<search::SingleStringExtAttribute>(name);
} else {
- LOG(debug, "Can not make an attribute out of %s of type '%s'.", name.c_str(), fv.getClass().name());
+ LOG(debug, "Can not make an attribute out of %s of type '%s'.", name.c_str(), vespalib::getClassName(fv).c_str());
}
return AttributeVector::SP();
}
@@ -761,14 +762,14 @@ void SearchVisitor::setupAttributeVector(const FieldPath &fieldPath) {
if (attr) {
LOG(debug, "Adding attribute '%s' for field '%s' with data type '%s' (%s)",
- attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), fv.getClass().name());
+ attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str());
if ( ! _attrMan.add(attr) ) {
LOG(warning, "Failed adding attribute '%s' for field '%s' with data type '%s' (%s)",
- attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), fv.getClass().name());
+ attr->getName().c_str(), attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str());
}
} else {
LOG(debug, "Cannot setup attribute for field '%s' with data type '%s' (%s). Aggregation and sorting will not work for this field",
- attrName.c_str(), fv.getDataType()->getName().c_str(), fv.getClass().name());
+ attrName.c_str(), fv.getDataType()->getName().c_str(), vespalib::getClassName(fv).c_str());
}
}