aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2018-04-19 15:06:15 +0000
committerTor Egge <Tor.Egge@oath.com>2018-04-20 08:48:48 +0000
commit834ea7c148b0595a11189bc7450ebb63483cbef6 (patch)
tree47aa4b0ab5322fd5d37536d8d112d5ec12fbc16d
parente3f7a936e403748ebb24d83490886b65bcd81ac7 (diff)
Change target attribute type in ImportedAttributeVector to
ReadableAttributeVector.
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributevector.h21
-rw-r--r--searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp5
-rw-r--r--searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h13
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.cpp20
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_read_guard.h13
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_search_context.h5
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h4
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp2
16 files changed, 106 insertions, 39 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
index 26322e78480..22e2e46c1e4 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
@@ -353,6 +353,27 @@ public:
virtual bool hasEnum() const = 0;
/**
+ * Returns whether the attribute vector is a filter attribute.
+ *
+ * @return true if attribute vector is a filter attribute.
+ */
+ virtual bool getIsFilter() const = 0;
+
+ /**
+ * Returns whether the attribute vector is marked as fast search.
+ *
+ * @return true if attribute vector is marked as fast search.
+ */
+ virtual bool getIsFastSearch() const = 0;
+
+ /*
+ * Returns the committed docid limit for the attribute.
+ *
+ * @return committed docid limit for the attribute.
+ */
+ virtual uint32_t getCommittedDocIdLimitSlow() const = 0;
+
+ /**
* Will serialize the values for the documentid in ascending order. The serialized form can be used by memcmp and
* sortorder will be preserved.
* @param doc The document id to serialize for.
diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
index e905354a69f..998537b2745 100644
--- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
+++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp
@@ -84,7 +84,10 @@ struct Fixture {
return *this;
}
AttributeVector::SP getTargetAttribute(const vespalib::string &importedName) const {
- return repo.get(importedName)->getTargetAttribute();
+ auto readable_target_attr = repo.get(importedName)->getTargetAttribute();
+ auto target_attr = std::dynamic_pointer_cast<AttributeVector>(readable_target_attr);
+ ASSERT_TRUE(target_attr);
+ return target_attr;
}
void clearContext() {
ctx.reset();
diff --git a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
index 53ad20c3b03..e8e16ffcc98 100644
--- a/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
+++ b/searchlib/src/tests/attribute/imported_search_context/imported_search_context_test.cpp
@@ -20,7 +20,7 @@ struct Fixture : ImportedAttributeFixture {
Fixture(bool useSearchCache = false) : ImportedAttributeFixture(useSearchCache) {}
std::unique_ptr<ImportedSearchContext> create_context(std::unique_ptr<QueryTermSimple> term) {
- return std::make_unique<ImportedSearchContext>(std::move(term), SearchContextParams(), *imported_attr);
+ return std::make_unique<ImportedSearchContext>(std::move(term), SearchContextParams(), *imported_attr, *target_attr);
}
std::unique_ptr<SearchIterator> create_iterator(
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index 2e88587337c..e6cfe303bed 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -330,6 +330,22 @@ AttributeVector::getCollectionType() const {
}
bool
+AttributeVector::getIsFilter() const {
+ return _config.getIsFilter();
+}
+
+bool
+AttributeVector::getIsFastSearch() const {
+ return _config.fastSearch();
+}
+
+uint32_t
+AttributeVector::getCommittedDocIdLimitSlow() const
+{
+ return getCommittedDocIdLimit();
+}
+
+bool
AttributeVector::headerTypeOK(const vespalib::GenericHeader &header) const
{
return header.hasTag(dataTypeTag) &&
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index 33b499b7400..ff13a03e422 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -431,6 +431,9 @@ public:
// Implements IAttributeVector
virtual BasicType::Type getBasicType() const override;
virtual CollectionType::Type getCollectionType() const override;
+ virtual bool getIsFilter() const override;
+ virtual bool getIsFastSearch() const override;
+ virtual uint32_t getCommittedDocIdLimitSlow() const override;
/**
* Updates the base file name of this attribute vector and saves
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
index 62244b2c3d6..768593d25b4 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
@@ -10,7 +10,7 @@ namespace search::attribute {
ImportedAttributeVector::ImportedAttributeVector(
vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache)
: _name(name),
@@ -24,7 +24,7 @@ ImportedAttributeVector::ImportedAttributeVector(
ImportedAttributeVector::ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
: _name(name),
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
index 747869b5b8e..cbd468d487e 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
@@ -8,13 +8,12 @@
namespace search {
-class AttributeVector;
-class AttributeEnumGuard;
class IDocumentMetaStoreContext;
namespace attribute {
class BitVectorSearchCache;
+class ReadableAttributeVector;
class ReferenceAttribute;
/**
@@ -27,17 +26,17 @@ class ReferenceAttribute;
* Any accessor on the imported attribute for a local LID yields the same result as
* if the same accessor were invoked with the target LID on the target attribute vector.
*/
-class ImportedAttributeVector : public ReadableAttributeVector {
+class ImportedAttributeVector : public attribute::ReadableAttributeVector {
public:
using SP = std::shared_ptr<ImportedAttributeVector>;
ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache);
ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
virtual ~ImportedAttributeVector();
@@ -45,7 +44,7 @@ public:
const std::shared_ptr<ReferenceAttribute>& getReferenceAttribute() const noexcept {
return _reference_attribute;
}
- const std::shared_ptr<AttributeVector>& getTargetAttribute() const noexcept {
+ const std::shared_ptr<attribute::ReadableAttributeVector>& getTargetAttribute() const noexcept {
return _target_attribute;
}
const std::shared_ptr<IDocumentMetaStoreContext> &getDocumentMetaStore() const {
@@ -64,7 +63,7 @@ public:
protected:
vespalib::string _name;
std::shared_ptr<ReferenceAttribute> _reference_attribute;
- std::shared_ptr<AttributeVector> _target_attribute;
+ std::shared_ptr<attribute::ReadableAttributeVector> _target_attribute;
std::shared_ptr<IDocumentMetaStoreContext> _document_meta_store;
std::shared_ptr<BitVectorSearchCache> _search_cache;
};
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp
index c9b9c9dd9d5..9006424a423 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp
@@ -2,7 +2,8 @@
#include "imported_attribute_vector_factory.h"
#include "imported_attribute_vector.h"
-#include "attributevector.h"
+#include "attribute_read_guard.h"
+#include <vespa/searchcommon/attribute/iattributevector.h>
#include <vespa/searchlib/tensor/imported_tensor_attribute_vector.h>
namespace search::attribute {
@@ -11,9 +12,14 @@ using search::tensor::ImportedTensorAttributeVector;
namespace {
-BasicType::Type getBasicType(const std::shared_ptr<AttributeVector> &attr)
+BasicType::Type getBasicType(const std::shared_ptr<attribute::ReadableAttributeVector> &attr)
{
- return attr ? attr->getBasicType() : BasicType::Type::NONE;
+ if (attr) {
+ auto readGuard = attr->makeReadGuard(false);
+ return readGuard->attribute()->getBasicType();
+ }else {
+ return BasicType::Type::NONE;
+ }
}
}
@@ -21,7 +27,7 @@ BasicType::Type getBasicType(const std::shared_ptr<AttributeVector> &attr)
std::shared_ptr<ImportedAttributeVector>
ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache)
{
@@ -37,7 +43,7 @@ ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ImportedAttributeVector>
ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
{
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h
index 363fb9f29bc..9c3b5a8bb47 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h
@@ -7,13 +7,13 @@
namespace search {
-class AttributeVector;
class IDocumentMetaStoreContext;
namespace attribute {
class BitVectorSearchCache;
class ImportedAttributeVector;
+class ReadableAttributeVector;
class ReferenceAttribute;
/*
@@ -25,14 +25,14 @@ public:
static std::shared_ptr<ImportedAttributeVector>
create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache);
static std::shared_ptr<ImportedAttributeVector>
create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
};
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 8c917a98f2b..98e93fb41df 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
@@ -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 "imported_attribute_vector_read_guard.h"
+#include "imported_attribute_vector.h"
#include "imported_search_context.h"
#include "reference_attribute.h"
#include <vespa/searchlib/common/i_gid_to_lid_mapper.h>
@@ -17,10 +18,9 @@ ImportedAttributeVectorReadGuard::ImportedAttributeVectorReadGuard(
_imported_attribute(imported_attribute),
_referencedLids(),
_reference_attribute_guard(imported_attribute.getReferenceAttribute()),
- _target_attribute_guard(stableEnumGuard ? std::shared_ptr<AttributeVector>() : imported_attribute.getTargetAttribute()),
- _target_attribute_enum_guard(stableEnumGuard ? imported_attribute.getTargetAttribute(): std::shared_ptr<AttributeVector>()),
+ _target_attribute_guard(imported_attribute.getTargetAttribute()->makeReadGuard(stableEnumGuard)),
_reference_attribute(*imported_attribute.getReferenceAttribute()),
- _target_attribute(*imported_attribute.getTargetAttribute()),
+ _target_attribute(*_target_attribute_guard->attribute()),
_mapper(_reference_attribute.getGidToLidMapperFactory()->getMapper())
{
_referencedLids = _reference_attribute.getReferencedLids();
@@ -107,7 +107,7 @@ const char * ImportedAttributeVectorReadGuard::getStringFromEnum(EnumHandle e) c
std::unique_ptr<ISearchContext> ImportedAttributeVectorReadGuard::createSearchContext(std::unique_ptr<QueryTermSimple> term,
const SearchContextParams &params) const {
- return std::make_unique<ImportedSearchContext>(std::move(term), params, _imported_attribute);
+ return std::make_unique<ImportedSearchContext>(std::move(term), params, _imported_attribute, _target_attribute);
}
const IDocumentWeightAttribute *ImportedAttributeVectorReadGuard::asDocumentWeightAttribute() const {
@@ -134,6 +134,18 @@ bool ImportedAttributeVectorReadGuard::hasEnum() const {
return _target_attribute.hasEnum();
}
+bool ImportedAttributeVectorReadGuard::getIsFilter() const {
+ return _target_attribute.getIsFilter();
+}
+
+bool ImportedAttributeVectorReadGuard::getIsFastSearch() const {
+ return _target_attribute.getIsFastSearch();
+}
+
+uint32_t ImportedAttributeVectorReadGuard::getCommittedDocIdLimitSlow() const {
+ return _reference_attribute.getCommittedDocIdLimit();
+}
+
long ImportedAttributeVectorReadGuard::onSerializeForAscendingSort(DocId doc,
void *serTo,
long available,
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 9623bc9c17d..6c02c20c48a 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
@@ -4,7 +4,6 @@
#include "attribute_read_guard.h"
#include "attributeguard.h"
-#include "imported_attribute_vector.h"
#include <vespa/vespalib/util/arrayref.h>
#include <vespa/searchcommon/attribute/iattributevector.h>
@@ -13,6 +12,8 @@ namespace search { class IGidToLidMapper; }
namespace search::attribute {
class BitVectorSearchCache;
+class ImportedAttributeVector;
+class ReferenceAttribute;
/*
* Short lived attribute vector that does not store values on its own.
@@ -28,10 +29,11 @@ private:
const ImportedAttributeVector &_imported_attribute;
ReferencedLids _referencedLids;
AttributeGuard _reference_attribute_guard;
- AttributeGuard _target_attribute_guard;
- AttributeEnumGuard _target_attribute_enum_guard;
+ std::unique_ptr<attribute::AttributeReadGuard> _target_attribute_guard;
const ReferenceAttribute &_reference_attribute;
- const AttributeVector &_target_attribute;
+protected:
+ const IAttributeVector &_target_attribute;
+private:
std::unique_ptr<IGidToLidMapper> _mapper;
protected:
@@ -71,6 +73,9 @@ public:
virtual size_t getFixedWidth() const override;
virtual CollectionType::Type getCollectionType() const override;
virtual bool hasEnum() const override;
+ virtual bool getIsFilter() const override;
+ virtual bool getIsFastSearch() const override;
+ virtual uint32_t getCommittedDocIdLimitSlow() const override;
protected:
virtual long onSerializeForAscendingSort(DocId doc, void * serTo, long available,
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
index 5db01012248..8260bd80a8b 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.cpp
@@ -24,7 +24,8 @@ namespace search::attribute {
ImportedSearchContext::ImportedSearchContext(
std::unique_ptr<QueryTermSimple> term,
const SearchContextParams& params,
- const ImportedAttributeVector& imported_attribute)
+ const ImportedAttributeVector& imported_attribute,
+ const attribute::IAttributeVector &target_attribute)
: _imported_attribute(imported_attribute),
_queryTerm(term->getTerm()),
_useSearchCache(_imported_attribute.getSearchCache().get() != nullptr),
@@ -33,7 +34,7 @@ ImportedSearchContext::ImportedSearchContext(
_dmsReadGuard((_useSearchCache && !_searchCacheLookup) ? imported_attribute.getDocumentMetaStore()->getReadGuard() :
std::unique_ptr<IDocumentMetaStoreContext::IReadGuard>()),
_reference_attribute(*_imported_attribute.getReferenceAttribute()),
- _target_attribute(*_imported_attribute.getTargetAttribute()),
+ _target_attribute(target_attribute),
_target_search_context(_target_attribute.createSearchContext(std::move(term), params)),
_referencedLids(_reference_attribute.getReferencedLids()),
_merger(_reference_attribute.getCommittedDocIdLimit()),
@@ -194,7 +195,7 @@ public:
void ImportedSearchContext::makeMergedPostings(bool isFilter)
{
- uint32_t committedTargetDocIdLimit = _target_attribute.getCommittedDocIdLimit();
+ uint32_t committedTargetDocIdLimit = _target_attribute.getCommittedDocIdLimitSlow();
std::atomic_thread_fence(std::memory_order_acquire);
const auto &reverseMapping = _reference_attribute.getReverseMapping();
if (isFilter) {
@@ -230,8 +231,8 @@ void ImportedSearchContext::fetchPostings(bool strict) {
_fetchPostingsDone = true;
if (!_searchCacheLookup) {
_target_search_context->fetchPostings(strict);
- if (strict || _target_attribute.getConfig().fastSearch()) {
- makeMergedPostings(_target_attribute.getConfig().getIsFilter());
+ if (strict || _target_attribute.getIsFastSearch()) {
+ makeMergedPostings(_target_attribute.getIsFilter());
considerAddSearchCacheEntry();
}
}
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h
index 32bca66cc1b..93db012d2e3 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_search_context.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_search_context.h
@@ -33,7 +33,7 @@ class ImportedSearchContext : public ISearchContext {
BitVectorSearchCache::Entry::SP _searchCacheLookup;
IDocumentMetaStoreContext::IReadGuard::UP _dmsReadGuard;
const ReferenceAttribute& _reference_attribute;
- const AttributeVector& _target_attribute;
+ const attribute::IAttributeVector &_target_attribute;
std::unique_ptr<ISearchContext> _target_search_context;
ReferencedLids _referencedLids;
PostingListMerger<int32_t> _merger;
@@ -48,7 +48,8 @@ class ImportedSearchContext : public ISearchContext {
public:
ImportedSearchContext(std::unique_ptr<QueryTermSimple> term,
const SearchContextParams& params,
- const ImportedAttributeVector& imported_attribute);
+ const ImportedAttributeVector& imported_attribute,
+ const attribute::IAttributeVector &target_attribute);
~ImportedSearchContext();
diff --git a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp
index 71aca30ca5e..6b3f4adb6e4 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp
@@ -10,7 +10,7 @@ using vespalib::tensor::Tensor;
ImportedTensorAttributeVector::ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache)
: ImportedAttributeVector(name, std::move(reference_attribute),
@@ -22,7 +22,7 @@ ImportedTensorAttributeVector::ImportedTensorAttributeVector(vespalib::stringref
ImportedTensorAttributeVector::ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
: ImportedAttributeVector(name, std::move(reference_attribute),
diff --git a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h
index b9f643b179f..c7ccd9ec599 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h
@@ -19,12 +19,12 @@ class ImportedTensorAttributeVector : public attribute::ImportedAttributeVector
public:
ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
bool use_search_cache);
ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<AttributeVector> target_attribute,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
~ImportedTensorAttributeVector();
diff --git a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
index 0c2b0d7d2c7..c6db5a76ed1 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector_read_guard.cpp
@@ -24,7 +24,7 @@ ImportedTensorAttributeVectorReadGuard::ImportedTensorAttributeVectorReadGuard(c
bool stableEnumGuard)
: ImportedAttributeVectorReadGuard(imported_attribute,
stableEnumGuard),
- _target_tensor_attribute(getTensorAttribute(*imported_attribute.getTargetAttribute()))
+ _target_tensor_attribute(getTensorAttribute(_target_attribute))
{
}