summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2018-04-23 13:38:48 +0000
committerTor Egge <Tor.Egge@oath.com>2018-04-23 13:53:39 +0000
commit6aa64a88856f769332476f16610812c004478ff8 (patch)
tree7db48103c3719f2e69cdc7b03ee202b4715b89c7 /searchlib
parenta4417a32a4e048bbdb2e347307f93de5bca865e1 (diff)
Add shared pointer to document meta store context for referenced
document type to imported attribute vector.
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h16
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp14
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h6
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp12
-rw-r--r--searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h6
-rw-r--r--searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h8
7 files changed, 50 insertions, 24 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
index 37969bc1eed..0ba4bc814d5 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
@@ -10,13 +10,15 @@ namespace search::attribute {
ImportedAttributeVector::ImportedAttributeVector(
vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
bool use_search_cache)
: _name(name),
_reference_attribute(std::move(reference_attribute)),
- _target_attribute(std::move(target_attribute)),
_document_meta_store(std::move(document_meta_store)),
+ _target_attribute(std::move(target_attribute)),
+ _target_document_meta_store(std::move(target_document_meta_store)),
_search_cache(use_search_cache ? std::make_shared<BitVectorSearchCache>() :
std::shared_ptr<BitVectorSearchCache>())
{
@@ -24,13 +26,15 @@ ImportedAttributeVector::ImportedAttributeVector(
ImportedAttributeVector::ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
: _name(name),
_reference_attribute(std::move(reference_attribute)),
- _target_attribute(std::move(target_attribute)),
_document_meta_store(std::move(document_meta_store)),
+ _target_attribute(std::move(target_attribute)),
+ _target_document_meta_store(std::move(target_document_meta_store)),
_search_cache(std::move(search_cache))
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
index 6ad69fa88eb..95fa65e98eb 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.h
@@ -31,24 +31,29 @@ public:
using SP = std::shared_ptr<ImportedAttributeVector>;
ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
bool use_search_cache);
ImportedAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
virtual ~ImportedAttributeVector();
const std::shared_ptr<ReferenceAttribute>& getReferenceAttribute() const noexcept {
return _reference_attribute;
}
+ const std::shared_ptr<IDocumentMetaStoreContext> &getDocumentMetaStore() const {
+ return _document_meta_store;
+ }
const std::shared_ptr<ReadableAttributeVector>& getTargetAttribute() const noexcept {
return _target_attribute;
}
- const std::shared_ptr<IDocumentMetaStoreContext> &getDocumentMetaStore() const {
- return _document_meta_store;
+ const std::shared_ptr<const IDocumentMetaStoreContext> &getTargetDocumentMetaStore() const {
+ return _target_document_meta_store;
}
const std::shared_ptr<BitVectorSearchCache> &getSearchCache() const {
return _search_cache;
@@ -63,8 +68,9 @@ public:
protected:
vespalib::string _name;
std::shared_ptr<ReferenceAttribute> _reference_attribute;
- std::shared_ptr<ReadableAttributeVector> _target_attribute;
std::shared_ptr<IDocumentMetaStoreContext> _document_meta_store;
+ std::shared_ptr<ReadableAttributeVector> _target_attribute;
+ std::shared_ptr<const IDocumentMetaStoreContext> _target_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 ae0fdcf1b83..5847b8953a4 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.cpp
@@ -27,15 +27,16 @@ BasicType::Type getBasicType(const std::shared_ptr<attribute::ReadableAttributeV
std::shared_ptr<ImportedAttributeVector>
ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
bool use_search_cache)
{
switch (getBasicType(target_attribute)) {
case BasicType::Type::TENSOR:
- return std::make_shared<ImportedTensorAttributeVector>(name, std::move(reference_attribute), std::move(target_attribute), std::move(document_meta_store), use_search_cache);
+ return std::make_shared<ImportedTensorAttributeVector>(name, std::move(reference_attribute), std::move(document_meta_store), std::move(target_attribute), std::move(target_document_meta_store), use_search_cache);
default:
- return std::make_shared<ImportedAttributeVector>(name, std::move(reference_attribute), std::move(target_attribute), std::move(document_meta_store), use_search_cache);
+ return std::make_shared<ImportedAttributeVector>(name, std::move(reference_attribute), std::move(document_meta_store), std::move(target_attribute), std::move(target_document_meta_store), use_search_cache);
}
}
@@ -43,15 +44,16 @@ ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ImportedAttributeVector>
ImportedAttributeVectorFactory::create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
{
switch (getBasicType(target_attribute)) {
case BasicType::Type::TENSOR:
- return std::make_shared<ImportedTensorAttributeVector>(name, std::move(reference_attribute), std::move(target_attribute), std::move(document_meta_store), std::move(search_cache));
+ return std::make_shared<ImportedTensorAttributeVector>(name, std::move(reference_attribute), std::move(document_meta_store), std::move(target_attribute), std::move(target_document_meta_store), std::move(search_cache));
default:
- return std::make_shared<ImportedAttributeVector>(name, std::move(reference_attribute), std::move(target_attribute), std::move(document_meta_store), std::move(search_cache));
+ return std::make_shared<ImportedAttributeVector>(name, std::move(reference_attribute), std::move(document_meta_store), std::move(target_attribute), std::move(target_document_meta_store), std::move(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 9c3b5a8bb47..c8836c0be1f 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector_factory.h
@@ -25,15 +25,17 @@ public:
static std::shared_ptr<ImportedAttributeVector>
create(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_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<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
};
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 6b3f4adb6e4..0b13c999984 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.cpp
@@ -10,24 +10,28 @@ using vespalib::tensor::Tensor;
ImportedTensorAttributeVector::ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
bool use_search_cache)
: ImportedAttributeVector(name, std::move(reference_attribute),
- std::move(target_attribute),
std::move(document_meta_store),
+ std::move(target_attribute),
+ std::move(target_document_meta_store),
use_search_cache)
{
}
ImportedTensorAttributeVector::ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache)
: ImportedAttributeVector(name, std::move(reference_attribute),
- std::move(target_attribute),
std::move(document_meta_store),
+ std::move(target_attribute),
+ std::move(target_document_meta_store),
std::move(search_cache))
{
}
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 c7ccd9ec599..5d5d363d193 100644
--- a/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h
+++ b/searchlib/src/vespa/searchlib/tensor/imported_tensor_attribute_vector.h
@@ -19,13 +19,15 @@ class ImportedTensorAttributeVector : public attribute::ImportedAttributeVector
public:
ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
bool use_search_cache);
ImportedTensorAttributeVector(vespalib::stringref name,
std::shared_ptr<ReferenceAttribute> reference_attribute,
- std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
std::shared_ptr<IDocumentMetaStoreContext> document_meta_store,
+ std::shared_ptr<attribute::ReadableAttributeVector> target_attribute,
+ std::shared_ptr<const IDocumentMetaStoreContext> target_document_meta_store,
std::shared_ptr<BitVectorSearchCache> search_cache);
~ImportedTensorAttributeVector();
diff --git a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
index 3eb20e1b646..1c4813a5c45 100644
--- a/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
+++ b/searchlib/src/vespa/searchlib/test/imported_attribute_fixture.h
@@ -64,6 +64,10 @@ std::shared_ptr<ReferenceAttribute> create_reference_attribute(vespalib::stringr
return std::make_shared<ReferenceAttribute>(name, Config(BasicType::REFERENCE));
}
+MockDocumentMetaStoreContext::SP create_target_document_meta_store() {
+ return std::make_shared<MockDocumentMetaStoreContext>();
+}
+
MockDocumentMetaStoreContext::SP create_document_meta_store() {
return std::make_shared<MockDocumentMetaStoreContext>();
}
@@ -149,6 +153,7 @@ struct ReadGuardWrapper {
struct ImportedAttributeFixture {
bool use_search_cache;
std::shared_ptr<AttributeVector> target_attr;
+ MockDocumentMetaStoreContext::SP target_document_meta_store;
std::shared_ptr<ReferenceAttribute> reference_attr;
MockDocumentMetaStoreContext::SP document_meta_store;
std::shared_ptr<ImportedAttributeVector> imported_attr;
@@ -180,7 +185,7 @@ struct ImportedAttributeFixture {
std::shared_ptr<ImportedAttributeVector>
create_attribute_vector_from_members(vespalib::stringref name = default_imported_attr_name()) {
- return ImportedAttributeVectorFactory::create(name, reference_attr, target_attr, document_meta_store, use_search_cache);
+ return ImportedAttributeVectorFactory::create(name, reference_attr, document_meta_store, target_attr, target_document_meta_store, use_search_cache);
}
template<typename AttrVecType>
@@ -283,6 +288,7 @@ struct ImportedAttributeFixture {
ImportedAttributeFixture::ImportedAttributeFixture(bool use_search_cache_)
: use_search_cache(use_search_cache_),
target_attr(create_single_attribute<IntegerAttribute>(BasicType::INT32)),
+ target_document_meta_store(create_target_document_meta_store()),
reference_attr(create_reference_attribute()),
document_meta_store(create_document_meta_store()),
imported_attr(create_attribute_vector_from_members()),