diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp index a38d16d6792a..aa02e1d1f6a5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_vector_explorer.cpp @@ -108,23 +108,10 @@ convertPostingBaseToSlime(const IPostingListAttributeBase &postingBase, Cursor & convertMemoryUsageToSlime(memory_usage.bitvectors, cursor.setObject("bitvectors")); } -std::string -type_to_string(const Config& cfg) -{ - if (cfg.basicType().type() == BasicType::TENSOR) { - return cfg.tensorType().to_spec(); - } - if (cfg.collectionType().type() == CollectionType::SINGLE) { - return cfg.basicType().asString(); - } - return std::string(cfg.collectionType().asString()) + - "<" + std::string(cfg.basicType().asString()) + ">"; -} - void convert_config_to_slime(const Config& cfg, bool full, Cursor& object) { - object.setString("type", type_to_string(cfg)); + object.setString("type", cfg.type_to_string()); object.setBool("fast_search", cfg.fastSearch()); object.setBool("filter", cfg.getIsFilter()); object.setBool("paged", cfg.paged()); diff --git a/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp b/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp index ca1b707a2906..8c91cfca5f8e 100644 --- a/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp +++ b/searchlib/src/tests/attribute/raw_attribute/raw_attribute_test.cpp @@ -181,7 +181,7 @@ TEST_F(RawAttributeTest, search_is_not_implemented) EXPECT_NE(nullptr, dynamic_cast(ctx.get())); } std::vector exp; - exp.emplace_back("Search is not implemented for attribute 'raw' of type 'search::attribute::SingleRawAttribute'."); + exp.emplace_back("Search is not supported for attribute 'raw' of type 'raw' ('search::attribute::SingleRawAttribute')."); EXPECT_EQ(exp, handler.list); } diff --git a/searchlib/src/vespa/searchcommon/attribute/config.cpp b/searchlib/src/vespa/searchcommon/attribute/config.cpp index 393b4e3b5e08..e862ed8d5a2a 100644 --- a/searchlib/src/vespa/searchcommon/attribute/config.cpp +++ b/searchlib/src/vespa/searchcommon/attribute/config.cpp @@ -70,4 +70,17 @@ Config::set_hnsw_index_params(const HnswIndexParams& params) { return *this; } +std::string +Config::type_to_string() const +{ + if (basicType().type() == BasicType::TENSOR) { + return tensorType().to_spec(); + } + if (collectionType().type() == CollectionType::SINGLE) { + return basicType().asString(); + } + return std::string(collectionType().asString()) + + "<" + std::string(basicType().asString()) + ">"; +} + } diff --git a/searchlib/src/vespa/searchcommon/attribute/config.h b/searchlib/src/vespa/searchcommon/attribute/config.h index 01ee80892f6a..61e4434dbc95 100644 --- a/searchlib/src/vespa/searchcommon/attribute/config.h +++ b/searchlib/src/vespa/searchcommon/attribute/config.h @@ -97,6 +97,7 @@ class Config { uint64_t getMaxUnCommittedMemory() const noexcept { return _maxUnCommittedMemory; } Config & setMaxUnCommittedMemory(uint64_t value) { _maxUnCommittedMemory = value; return *this; } + std::string type_to_string() const; private: BasicType _basicType; diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp index 6acd9de2dcb1..b4549c1c0d05 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp @@ -140,8 +140,8 @@ NotImplementedAttribute::addDoc(DocId &) { std::unique_ptr NotImplementedAttribute::getSearch(QueryTermSimpleUP, const attribute::SearchContextParams &) const { - Issue::report("Search is not implemented for attribute '%s' of type '%s'.", - getName().c_str(), getClassName(*this).c_str()); + Issue::report("Search is not supported for attribute '%s' of type '%s' ('%s').", + getName().c_str(), getConfig().type_to_string().c_str(), getClassName(*this).c_str()); return std::make_unique(*this); }