summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahooinc.com>2022-03-29 17:06:54 +0200
committerGitHub <noreply@github.com>2022-03-29 17:06:54 +0200
commit8767ac58447aa6189155cc1aeff5aab756a1d097 (patch)
treeff02357f4b333fe18591dafd6ae039031bb645ca /searchlib
parentc08e97667bf2c6ba60044ed7428e82e8d87dd5db (diff)
parentf11ab47d3ab497a63cad4538cb82d9492bc871af (diff)
Merge pull request #21881 from vespa-engine/geirst/raw-data-apis-for-multi-value-attributes
Raw data apis for multi value attributes
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/floatbase.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/integerbase.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/load_utils.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multi_value_mapping.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multienumattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multienumattributesaver.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multistringattribute.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multivalue.h60
-rw-r--r--searchlib/src/vespa/searchlib/attribute/postingchange.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/features/dotproductfeature.h4
15 files changed, 19 insertions, 72 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 07563ad369d..f83bcde817b 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -567,6 +567,7 @@ attribute::IPostingListAttributeBase *AttributeVector::getIPostingListAttributeB
const attribute::IPostingListAttributeBase *AttributeVector::getIPostingListAttributeBase() const { return nullptr; }
const IDocumentWeightAttribute * AttributeVector::asDocumentWeightAttribute() const { return nullptr; }
const tensor::ITensorAttribute *AttributeVector::asTensorAttribute() const { return nullptr; }
+const attribute::IMultiValueAttribute* AttributeVector::as_multi_value_attribute() const { return nullptr; }
bool AttributeVector::hasPostings() { return getIPostingListAttributeBase() != nullptr; }
uint64_t AttributeVector::getUniqueValueCount() const { return getTotalValueCount(); }
uint64_t AttributeVector::getTotalValueCount() const { return getNumDocs(); }
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 8f0ce6327a8..ce65664d7d7 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -497,6 +497,7 @@ public:
const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
const tensor::ITensorAttribute *asTensorAttribute() const override;
+ const attribute::IMultiValueAttribute* as_multi_value_attribute() const override;
/**
- Search for equality
diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h
index 8db89535ebf..d27d7ba5925 100644
--- a/searchlib/src/vespa/searchlib/attribute/floatbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h
@@ -2,9 +2,9 @@
#pragma once
#include "numericbase.h"
-#include "multivalue.h"
#include "loadednumericvalue.h"
#include "changevector.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
index 2a5d57475ca..f1ae5252031 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp
@@ -119,6 +119,10 @@ const tensor::ITensorAttribute *ImportedAttributeVectorReadGuard::asTensorAttrib
return nullptr;
}
+const attribute::IMultiValueAttribute* ImportedAttributeVectorReadGuard::as_multi_value_attribute() const {
+ return nullptr;
+}
+
BasicType::Type ImportedAttributeVectorReadGuard::getBasicType() const {
return _target_attribute.getBasicType();
}
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
index 502215f58cd..f5b896e2da5 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h
@@ -76,6 +76,7 @@ public:
const SearchContextParams &params) const override;
const IDocumentWeightAttribute *asDocumentWeightAttribute() const override;
const tensor::ITensorAttribute *asTensorAttribute() const override;
+ const attribute::IMultiValueAttribute* as_multi_value_attribute() const override;
BasicType::Type getBasicType() const override;
size_t getFixedWidth() const override;
CollectionType::Type getCollectionType() const override;
diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h
index 50a3f314795..60dd527282a 100644
--- a/searchlib/src/vespa/searchlib/attribute/integerbase.h
+++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h
@@ -2,9 +2,9 @@
#pragma once
#include "numericbase.h"
-#include "multivalue.h"
#include "loadednumericvalue.h"
#include "changevector.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
index 7a1f24fdef6..0e7a73a763d 100644
--- a/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/load_utils.cpp
@@ -4,8 +4,8 @@
#include "load_utils.hpp"
#include "loadedenumvalue.h"
#include "multi_value_mapping.h"
-#include "multivalue.h"
#include <vespa/fastos/file.h>
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/searchlib/util/fileutil.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/array.hpp>
diff --git a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.cpp b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.cpp
index ffd380c174b..a71bfcff04a 100644
--- a/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multi_value_mapping.cpp
@@ -4,7 +4,7 @@
#include "i_enum_store.h"
#include "multi_value_mapping.h"
#include "multi_value_mapping.hpp"
-#include "multivalue.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/vespalib/datastore/atomic_entry_ref.h>
#include <vespa/vespalib/datastore/buffer_type.hpp>
#include <vespa/vespalib/util/array.hpp>
diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
index fb3e66ac60a..48c870e5aa7 100644
--- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.h
@@ -4,9 +4,9 @@
#include "i_enum_store.h"
#include "loadedenumvalue.h"
-#include "multivalue.h"
#include "multivalueattribute.h"
#include "no_loaded_vector.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattributesaver.cpp b/searchlib/src/vespa/searchlib/attribute/multienumattributesaver.cpp
index 41a687c6fad..6e35a352b75 100644
--- a/searchlib/src/vespa/searchlib/attribute/multienumattributesaver.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multienumattributesaver.cpp
@@ -2,7 +2,7 @@
#include "multienumattributesaver.h"
#include "multivalueattributesaverutils.h"
-#include "multivalue.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.attribute.multi_enum_attribute_saver");
diff --git a/searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.cpp b/searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.cpp
index 031d8c9649d..c458cb2d1cc 100644
--- a/searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multinumericattributesaver.cpp
@@ -2,7 +2,7 @@
#include "multinumericattributesaver.h"
#include "multivalueattributesaverutils.h"
-#include "multivalue.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/searchlib/util/bufferwriter.h>
using vespalib::GenerationHandler;
diff --git a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h
index 415bfa25b16..66ca9f5c04c 100644
--- a/searchlib/src/vespa/searchlib/attribute/multistringattribute.h
+++ b/searchlib/src/vespa/searchlib/attribute/multistringattribute.h
@@ -8,7 +8,7 @@
#include "multienumattribute.h"
#include "multi_value_mapping.h"
#include "enumhintsearchcontext.h"
-#include "multivalue.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
namespace search {
diff --git a/searchlib/src/vespa/searchlib/attribute/multivalue.h b/searchlib/src/vespa/searchlib/attribute/multivalue.h
deleted file mode 100644
index 780e8627b91..00000000000
--- a/searchlib/src/vespa/searchlib/attribute/multivalue.h
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <cstdint>
-
-namespace search::multivalue {
-
-template <typename T>
-class Value {
-public:
- typedef T ValueType;
- Value() noexcept : _v() {}
- Value(T v) noexcept : _v(v) { }
- Value(T v, int32_t w) noexcept : _v(v) { (void) w; }
- T value() const { return _v; }
- const T& value_ref() const { return _v; }
- T& value_ref() { return _v; }
- operator T () const { return _v; }
- operator T & () { return _v; }
- int32_t weight() const { return 1; }
- void setWeight(int32_t w) { (void) w; }
- void incWeight(int32_t w) { (void) w; }
- bool operator ==(const Value<T> & rhs) const { return _v == rhs._v; }
- bool operator <(const Value<T> & rhs) const { return _v < rhs._v; }
- bool operator >(const Value<T> & rhs) const { return _v > rhs._v; }
- static bool hasWeight() { return false; }
-
- static constexpr bool _hasWeight = false;
-private:
- T _v;
-};
-
-template <typename T>
-class WeightedValue {
-public:
- typedef T ValueType;
- WeightedValue() noexcept : _v(), _w(1) { }
- WeightedValue(T v, int32_t w) noexcept : _v(v), _w(w) { }
- T value() const { return _v; }
- const T& value_ref() const { return _v; }
- T& value_ref() { return _v; }
- operator T () const { return _v; }
- operator T & () { return _v; }
- int32_t weight() const { return _w; }
- void setWeight(int32_t w) { _w = w; }
- void incWeight(int32_t w) { _w += w; }
-
- bool operator==(const WeightedValue<T> & rhs) const { return _v == rhs._v; }
- bool operator <(const WeightedValue<T> & rhs) const { return _v < rhs._v; }
- bool operator >(const WeightedValue<T> & rhs) const { return _v > rhs._v; }
- static bool hasWeight() { return true; }
-
- static constexpr bool _hasWeight = true;
-private:
- T _v;
- int32_t _w;
-};
-
-}
diff --git a/searchlib/src/vespa/searchlib/attribute/postingchange.cpp b/searchlib/src/vespa/searchlib/attribute/postingchange.cpp
index a06ee9dab2b..85e801fa045 100644
--- a/searchlib/src/vespa/searchlib/attribute/postingchange.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/postingchange.cpp
@@ -1,12 +1,12 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "postingchange.h"
-#include "multivalue.h"
#include "multi_value_mapping.h"
#include "postinglistattribute.h"
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/searchlib/common/growablebitvector.h>
-#include <vespa/vespalib/util/array.hpp>
#include <vespa/vespalib/stllike/hash_map.hpp>
+#include <vespa/vespalib/util/array.hpp>
using vespalib::datastore::AtomicEntryRef;
diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h
index d03bc36da01..ad5864f86c7 100644
--- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h
+++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h
@@ -3,10 +3,10 @@
#pragma once
#include "utils.h"
+#include <vespa/searchcommon/attribute/attributecontent.h>
+#include <vespa/searchcommon/attribute/multivalue.h>
#include <vespa/searchlib/fef/blueprint.h>
-#include <vespa/searchlib/attribute/multivalue.h>
#include <vespa/vespalib/hwaccelrated/iaccelrated.h>
-#include <vespa/searchcommon/attribute/attributecontent.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
namespace search::fef { class Property; }