diff options
20 files changed, 59 insertions, 333 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index b034b77086c..62dd1610147 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -45,6 +45,7 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/util/size_literals.h> +#include <vespa/config-summary.h> #include <filesystem> #include <regex> diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h index ef2b732a0a9..13e693dfe55 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h @@ -1,14 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/searchlib/attribute/iattributemanager.h> #include <vespa/searchlib/docstore/idocumentstore.h> #include <vespa/searchsummary/docsummary/docsumstore.h> #include <vespa/searchsummary/docsummary/docsumwriter.h> #include <vespa/searchsummary/docsummary/idocsumenvironment.h> #include <vespa/searchsummary/docsummary/resultconfig.h> -#include <vespa/config-summary.h> namespace document { class DocumentTypeRepo; } @@ -20,6 +18,8 @@ namespace proton { class ISummaryManager { public: + using SummaryConfig = vespa::config::search::internal::InternalSummaryType; + using JuniperrcConfig = vespa::config::search::summary::internal::InternalJuniperrcType; ISummaryManager(const ISummaryManager &) = delete; ISummaryManager & operator = (const ISummaryManager &) = delete; /** @@ -40,11 +40,11 @@ public: typedef std::unique_ptr<ISummaryManager> UP; typedef std::shared_ptr<ISummaryManager> SP; - virtual ~ISummaryManager() {} + virtual ~ISummaryManager() = default; virtual ISummarySetup::SP - createSummarySetup(const vespa::config::search::SummaryConfig &summaryCfg, - const vespa::config::search::summary::JuniperrcConfig &juniperCfg, + createSummarySetup(const SummaryConfig &summaryCfg, + const JuniperrcConfig &juniperCfg, const std::shared_ptr<const document::DocumentTypeRepo> &repo, const std::shared_ptr<search::IAttributeManager> &attributeMgr) = 0; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp index 031d8ec87dc..d801465372a 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp @@ -13,6 +13,7 @@ #include <vespa/searchsummary/docsummary/keywordextractor.h> #include <vespa/vespalib/util/exceptions.h> #include <vespa/fastlib/text/normwordfolder.h> +#include <vespa/config-summary.h> #include <sstream> @@ -22,8 +23,6 @@ LOG_SETUP(".proton.docsummary.summarymanager"); using namespace config; using namespace document; using namespace search::docsummary; -using namespace vespa::config::search::summary; -using namespace vespa::config::search; using vespalib::make_string; using vespalib::IllegalArgumentException; using vespalib::compression::CompressionConfig; diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index be05498e19f..39df4c5ca70 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -31,8 +31,8 @@ public: const std::shared_ptr<const document::DocumentTypeRepo> _repo; public: SummarySetup(const vespalib::string & baseDir, - const vespa::config::search::SummaryConfig & summaryCfg, - const vespa::config::search::summary::JuniperrcConfig & juniperCfg, + const SummaryConfig & summaryCfg, + const JuniperrcConfig & juniperCfg, search::IAttributeManager::SP attributeMgr, search::IDocumentStore::SP docStore, std::shared_ptr<const document::DocumentTypeRepo> repo); @@ -69,8 +69,8 @@ public: searchcorespi::IFlushTarget::List getFlushTargets(vespalib::Executor & summaryService); ISummarySetup::SP - createSummarySetup(const vespa::config::search::SummaryConfig &summaryCfg, - const vespa::config::search::summary::JuniperrcConfig &juniperCfg, + createSummarySetup(const SummaryConfig &summaryCfg, + const JuniperrcConfig &juniperCfg, const std::shared_ptr<const document::DocumentTypeRepo> &repo, const search::IAttributeManager::SP &attributeMgr) override; diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h b/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h index e2a6802b4e9..a40d89d6edf 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h @@ -3,22 +3,17 @@ #include <vespa/searchcore/proton/docsummary/isummarymanager.h> -namespace proton { - -namespace test { +namespace proton::test { struct DummySummaryManager : public ISummaryManager { ISummarySetup::SP - createSummarySetup(const vespa::config::search::SummaryConfig &, - const vespa::config::search::summary::JuniperrcConfig &, + createSummarySetup(const SummaryConfig &, + const JuniperrcConfig &, const std::shared_ptr<const document::DocumentTypeRepo> &, const std::shared_ptr<search::IAttributeManager> &) override { - return ISummarySetup::SP(); + return {}; } }; -} // namespace test - -} // namespace proton - +} diff --git a/searchlib/CMakeLists.txt b/searchlib/CMakeLists.txt index f39018846a0..4d0f520f666 100644 --- a/searchlib/CMakeLists.txt +++ b/searchlib/CMakeLists.txt @@ -217,7 +217,6 @@ vespa_define_module( src/tests/sort src/tests/sortresults src/tests/sortspec - src/tests/stringenum src/tests/tensor/dense_tensor_store src/tests/tensor/direct_tensor_store src/tests/tensor/distance_functions diff --git a/searchlib/src/tests/stringenum/.gitignore b/searchlib/src/tests/stringenum/.gitignore deleted file mode 100644 index 7a2f1dd659f..00000000000 --- a/searchlib/src/tests/stringenum/.gitignore +++ /dev/null @@ -1,8 +0,0 @@ -*.core -.depend -Makefile -core -core.* -stringenum -tmp.enum -searchlib_stringenum_test_app diff --git a/searchlib/src/tests/stringenum/CMakeLists.txt b/searchlib/src/tests/stringenum/CMakeLists.txt deleted file mode 100644 index d9c5a133c88..00000000000 --- a/searchlib/src/tests/stringenum/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchlib_stringenum_test_app TEST - SOURCES - stringenum_test.cpp - DEPENDS - searchlib -) -vespa_add_test(NAME searchlib_stringenum_test_app COMMAND searchlib_stringenum_test_app) diff --git a/searchlib/src/tests/stringenum/stringenum_test.cpp b/searchlib/src/tests/stringenum/stringenum_test.cpp deleted file mode 100644 index f5915db6df0..00000000000 --- a/searchlib/src/tests/stringenum/stringenum_test.cpp +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include <vespa/log/log.h> -#include <vespa/searchlib/util/stringenum.h> - -LOG_SETUP("stringenum"); -#include <vespa/vespalib/testkit/testapp.h> - -using namespace vespalib; - -void -CheckLookup( search::util::StringEnum *strEnum, const char *str, int value) -{ - EXPECT_EQUAL(0, strcmp(str, strEnum->Lookup(value))); - EXPECT_EQUAL(value, strEnum->Lookup(str)); -} - - -TEST("test StringEnum Add and Lookup") -{ - - search::util::StringEnum enum1; - - // check number of entries - EXPECT_EQUAL(enum1.GetNumEntries(), 0u); - - // check add non-duplicates - EXPECT_EQUAL(enum1.Add("zero"), 0); - EXPECT_EQUAL(enum1.Add("one"), 1); - EXPECT_EQUAL(enum1.Add("two"), 2); - EXPECT_EQUAL(enum1.Add("three"), 3); - EXPECT_EQUAL(enum1.Add("four"), 4); - EXPECT_EQUAL(enum1.Add("five"), 5); - EXPECT_EQUAL(enum1.Add("six"), 6); - EXPECT_EQUAL(enum1.Add("seven"), 7); - EXPECT_EQUAL(enum1.Add("eight"), 8); - EXPECT_EQUAL(enum1.Add("nine"), 9); - - // check add duplicates - EXPECT_EQUAL(enum1.Add("four"), 4); - EXPECT_EQUAL(enum1.Add("eight"), 8); - EXPECT_EQUAL(enum1.Add("six"), 6); - EXPECT_EQUAL(enum1.Add("seven"), 7); - EXPECT_EQUAL(enum1.Add("one"), 1); - EXPECT_EQUAL(enum1.Add("nine"), 9); - EXPECT_EQUAL(enum1.Add("five"), 5); - EXPECT_EQUAL(enum1.Add("zero"), 0); - EXPECT_EQUAL(enum1.Add("two"), 2); - EXPECT_EQUAL(enum1.Add("three"), 3); - - // check add non-duplicate - EXPECT_EQUAL(enum1.Add("ten"), 10); - - // check mapping and reverse mapping - EXPECT_EQUAL(enum1.GetNumEntries(), 11u); - TEST_DO(CheckLookup(&enum1, "zero", 0)); - TEST_DO(CheckLookup(&enum1, "one", 1)); - TEST_DO(CheckLookup(&enum1, "two", 2)); - TEST_DO(CheckLookup(&enum1, "three", 3)); - TEST_DO(CheckLookup(&enum1, "four", 4)); - TEST_DO(CheckLookup(&enum1, "five", 5)); - TEST_DO(CheckLookup(&enum1, "six", 6)); - TEST_DO(CheckLookup(&enum1, "seven", 7)); - TEST_DO(CheckLookup(&enum1, "eight", 8)); - TEST_DO(CheckLookup(&enum1, "nine", 9)); - TEST_DO(CheckLookup(&enum1, "ten", 10)); - - // clear - enum1.Clear(); - - // check number of entries - EXPECT_EQUAL(enum1.GetNumEntries(), 0u); -} - -TEST_MAIN() { TEST_RUN_ALL(); } diff --git a/searchlib/src/vespa/searchlib/util/CMakeLists.txt b/searchlib/src/vespa/searchlib/util/CMakeLists.txt index 619913f9ca6..0d8c8ecb2c2 100644 --- a/searchlib/src/vespa/searchlib/util/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/util/CMakeLists.txt @@ -17,7 +17,6 @@ vespa_add_library(searchlib_util OBJECT rawbuf.cpp slime_output_raw_buf_adapter.cpp state_explorer_utils.cpp - stringenum.cpp url.cpp DEPENDS ) diff --git a/searchlib/src/vespa/searchlib/util/stringenum.cpp b/searchlib/src/vespa/searchlib/util/stringenum.cpp deleted file mode 100644 index 116e400083a..00000000000 --- a/searchlib/src/vespa/searchlib/util/stringenum.cpp +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#include "stringenum.h" -#include <vespa/vespalib/stllike/hashtable.hpp> -#include <cassert> - -#include <vespa/log/log.h> -LOG_SETUP(".seachlib.util.stringenum"); - -namespace search::util { - -StringEnum::StringEnum() - : _numEntries(0), - _mapping(), - _reverseMap() -{ -} - -StringEnum::~StringEnum() = default; - -void -StringEnum::CreateReverseMapping() const -{ - _reverseMap.resize(_numEntries); - - for (Map::const_iterator it = _mapping.begin(); - it != _mapping.end(); - it++) - { - assert(it->second >= 0); - assert(it->second < (int)_numEntries); - _reverseMap[it->second] = it->first.c_str(); - } -} - -void -StringEnum::Clear() -{ - _reverseMap.clear(); - _mapping.clear(); - _numEntries = 0; -} - -int -StringEnum::Add(const char *str) -{ - Map::const_iterator found(_mapping.find(str)); - if (found != _mapping.end()) { - return found->second; - } else { - int value = _numEntries++; - _mapping[str] = value; - return value; - } -} - -int -StringEnum::Lookup(const char *str) const -{ - Map::const_iterator found(_mapping.find(str)); - return (found != _mapping.end()) ? found->second : -1; -} - -const char * -StringEnum::Lookup(uint32_t value) const -{ - if (value >= _numEntries) - return nullptr; - - if (_numEntries > _reverseMap.size()) - CreateReverseMapping(); - - return _reverseMap[value]; -} - -} diff --git a/searchlib/src/vespa/searchlib/util/stringenum.h b/searchlib/src/vespa/searchlib/util/stringenum.h deleted file mode 100644 index 0da79db323a..00000000000 --- a/searchlib/src/vespa/searchlib/util/stringenum.h +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -#pragma once - -#include <vector> -#include <vespa/vespalib/stllike/hash_map.h> - -namespace search::util { - -/** - * An object of this class represents an enumeration of a set of - * strings. This is useful for mapping a set of strings into a - * continuous range of integers. - **/ -class StringEnum -{ -private: - StringEnum(const StringEnum &); - StringEnum& operator=(const StringEnum &); - typedef vespalib::hash_map<vespalib::string, int> Map; - - uint32_t _numEntries; - Map _mapping; - mutable std::vector<const char *> _reverseMap; - - /** - * Create a reverse mapping that enables the user to map integers - * into strings. This method is called by the Lookup(int) method. - **/ - void CreateReverseMapping() const; - -public: - - /** - * Create an empty string enumeration. - **/ - StringEnum(); - - /** - * Destructor. - **/ - ~StringEnum(); - - /** - * Discard all entries held by this object. - **/ - void Clear(); - - /** - * Add a string to this enumeration. Equal strings will get the same - * enumerated value. Different string will get different enumerated - * values. The set of values returned from multiple invocations of - * this method will always be a contiuous range beginning at 0. - * - * @return the enumerated value for the given string. - * @param str string you want to add. - **/ - int Add(const char *str); - - /** - * Obtain the enumerated value for the given string. - * - * @return enumerated value or -1 if not present. - * @param str the string to look up. - **/ - int Lookup(const char *str) const; - - /** - * Obtain the string for the given enumerated value. - * - * @return string or NULL if out of range. - * @param value the enumerated value to look up. - **/ - const char *Lookup(uint32_t value) const; - - /** - * Obtain the number of entries currently present in this - * enumeration. - * - * @return current number of entries. - **/ - uint32_t GetNumEntries() const { return _numEntries; } -}; - -} diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp index 8f6d6ed02ea..feb4c63df34 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp @@ -2,8 +2,8 @@ #include "juniperproperties.h" #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/searchsummary/config/config-juniperrc.h> -using vespa::config::search::summary::JuniperrcConfig; using vespalib::make_string; namespace search::docsummary { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h index 88e819056cf..ff0829d9008 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h @@ -1,10 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once -#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/juniper/IJuniperProperties.h> +#include <vespa/vespalib/stllike/string.h> #include <map> +namespace vespa::config::search::summary::internal { + class InternalJuniperrcType; +} namespace search::docsummary { class JuniperProperties : public IJuniperProperties { @@ -19,6 +22,7 @@ private: public: + using JuniperrcConfig = vespa::config::search::summary::internal::InternalJuniperrcType;; /** * Constructs a juniper property object with default values set. */ @@ -26,7 +30,7 @@ public: /** * Constructs a juniper property object with default values set. */ - explicit JuniperProperties(const vespa::config::search::summary::JuniperrcConfig &cfg); + explicit JuniperProperties(const JuniperrcConfig &cfg); ~JuniperProperties() override; @@ -35,7 +39,7 @@ public: * * @param cfg The configuration object. */ - void configure(const vespa::config::search::summary::JuniperrcConfig &cfg); + void configure(const JuniperrcConfig &cfg); // Inherit doc from IJuniperProperties. const char *GetProperty(const char *name, const char *def) const override; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h index d55adb5d098..7b4168a3ed9 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultclass.h @@ -5,7 +5,6 @@ #include "res_config_entry.h" #include <vespa/vespalib/stllike/string.h> #include <vespa/vespalib/stllike/hash_map.h> -#include <vespa/searchlib/util/stringenum.h> namespace search::docsummary { @@ -36,10 +35,8 @@ public: }; private: - ResultClass(const ResultClass &); - ResultClass& operator=(const ResultClass &); - typedef vespalib::hash_map<vespalib::string, int> NameIdMap; - typedef std::vector<ResConfigEntry> Configs; + using NameIdMap = vespalib::hash_map<vespalib::string, int>; + using Configs = std::vector<ResConfigEntry>; vespalib::string _name; // name of this class Configs _entries; // config entries for this result class @@ -51,7 +48,7 @@ private: size_t _num_field_writer_states; public: - typedef std::unique_ptr<ResultClass> UP; + using UP = std::unique_ptr<ResultClass>; /** * Constructor. Assign name and id to this result class. Also gain @@ -59,7 +56,9 @@ public: * * @param name the name of this result class. **/ - ResultClass(const char *name); + explicit ResultClass(const char *name); + ResultClass(const ResultClass &) = delete; + ResultClass& operator=(const ResultClass &) = delete; /** * Destructor. Delete internal structures. @@ -118,8 +117,7 @@ public: * * @return config entry or NULL if not found. **/ - const ResConfigEntry *GetEntry(uint32_t offset) const - { + const ResConfigEntry *GetEntry(uint32_t offset) const { return (offset < _entries.size()) ? &_entries[offset] : nullptr; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp index 90186c5d1d5..0a4f607b962 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.cpp @@ -4,8 +4,8 @@ #include "docsum_field_writer.h" #include "docsum_field_writer_factory.h" #include "resultclass.h" -#include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/config-summary.h> #include <atomic> #include <vespa/log/log.h> @@ -23,11 +23,9 @@ ResultConfig::Clean() ResultConfig::ResultConfig() : _defaultSummaryId(-1), - _useV8geoPositions(false), _classLookup(), _nameLookup() { - } @@ -93,13 +91,12 @@ bool ResultConfig::wantedV8geoPositions() { } bool -ResultConfig::ReadConfig(const vespa::config::search::SummaryConfig &cfg, const char *configId, IDocsumFieldWriterFactory& docsum_field_writer_factory) +ResultConfig::ReadConfig(const SummaryConfig &cfg, const char *configId, IDocsumFieldWriterFactory& docsum_field_writer_factory) { bool rc = true; Reset(); int maxclassID = 0x7fffffff; // avoid negative classids _defaultSummaryId = cfg.defaultsummaryid; - _useV8geoPositions = cfg.usev8geopositions; global_useV8geoPositions = cfg.usev8geopositions; for (uint32_t i = 0; rc && i < cfg.classes.size(); i++) { diff --git a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h index 456cf9dea69..e0f460850f6 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/resultconfig.h @@ -3,9 +3,11 @@ #pragma once #include "res_type_utils.h" -#include <vespa/config-summary.h> -#include <vespa/searchlib/util/stringenum.h> +#include <vespa/vespalib/stllike/hash_map.h> +namespace vespa::config::search::internal { + class InternalSummaryType; +} namespace search::docsummary { class IDocsumFieldWriterFactory; @@ -28,20 +30,16 @@ class ResultClass; class ResultConfig { private: - ResultConfig(const ResultConfig &); - ResultConfig& operator=(const ResultConfig &); - - typedef vespalib::hash_map<vespalib::string, uint32_t> NameMap; - typedef vespalib::hash_map<uint32_t, std::unique_ptr<ResultClass>> IdMap; + using NameMap = vespalib::hash_map<vespalib::string, uint32_t>; + using IdMap = vespalib::hash_map<uint32_t, std::unique_ptr<ResultClass>>; uint32_t _defaultSummaryId; - bool _useV8geoPositions; IdMap _classLookup; NameMap _nameLookup; // name -> class id void Clean(); public: - bool useV8geoPositions() const { return _useV8geoPositions; } + using SummaryConfig = vespa::config::search::internal::InternalSummaryType; class iterator { public: iterator(IdMap::iterator it) : _it(it) { } @@ -68,16 +66,18 @@ public: IdMap::const_iterator _it; }; - iterator begin() { return iterator(_classLookup.begin()); } - iterator end() { return iterator(_classLookup.end()); } - const_iterator begin() const { return const_iterator(_classLookup.begin()); } - const_iterator end() const { return const_iterator(_classLookup.end()); } + iterator begin() { return { _classLookup.begin() }; } + iterator end() { return { _classLookup.end() }; } + const_iterator begin() const { return { _classLookup.begin() }; } + const_iterator end() const { return { _classLookup.end() }; } /** * Constructor. Create an initially empty result configuration. * NOTE: This method simply calls the Init method. **/ ResultConfig(); + ResultConfig(const ResultConfig &) = delete; + ResultConfig& operator=(const ResultConfig &) = delete; /** * Destructor. Delete all internal structures. NOTE: This method @@ -144,22 +144,13 @@ public: **/ uint32_t LookupResultClassId(const vespalib::string &name) const; - - /** - * Obtain the number of result classes held by this result - * configuration. - * - * @return number of result classes. - **/ - uint32_t GetNumResultClasses() const { return _classLookup.size(); } - /** * Read config that has been fetched from configserver. * * @return true(success)/false(fail) * @param configId reference on server **/ - bool ReadConfig(const vespa::config::search::SummaryConfig &cfg, const char *configId, IDocsumFieldWriterFactory& docsum_field_writer_factory); + bool ReadConfig(const SummaryConfig &cfg, const char *configId, IDocsumFieldWriterFactory& docsum_field_writer_factory); }; } diff --git a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp index 2ccaf7f9bee..1ac452e11d4 100644 --- a/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp +++ b/streamingvisitors/src/vespa/searchvisitor/searchenvironment.cpp @@ -2,6 +2,7 @@ #include "searchenvironment.h" #include <vespa/vespalib/stllike/hash_map.hpp> +#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/log/log.h> LOG_SETUP(".visitor.instance.searchenvironment"); @@ -11,7 +12,7 @@ using vsm::VSMAdapter; namespace streaming { -__thread SearchEnvironment::EnvMap * SearchEnvironment::_localEnvMap=0; +__thread SearchEnvironment::EnvMap * SearchEnvironment::_localEnvMap = nullptr; SearchEnvironment::Env::Env(const vespalib::string & muffens, const config::ConfigUri & configUri, Fast_NormalizeWordFolder & wf) : _configId(configUri.getConfigId()), diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp index 59f10df0837..4877f114ebb 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.cpp @@ -5,6 +5,7 @@ #include "i_matching_elements_filler.h" #include <vespa/searchlib/common/matching_elements.h> #include <vespa/searchsummary/docsummary/keywordextractor.h> +#include <vespa/searchsummary/config/config-juniperrc.h> #include <vespa/log/log.h> LOG_SETUP(".vsm.vsm-adapter"); @@ -13,6 +14,8 @@ using search::docsummary::ResConfigEntry; using search::docsummary::KeywordExtractor; using search::MatchingElements; using config::ConfigSnapshot; +using vespa::config::search::SummaryConfig; +using vespa::config::search::summary::JuniperrcConfig; namespace vsm { @@ -37,12 +40,6 @@ void GetDocsumsStateCallback::FillRankFeatures(GetDocsumsState& state) } } -void GetDocsumsStateCallback::FillDocumentLocations(GetDocsumsState *state, IDocsumEnvironment * env) -{ - (void) state; - (void) env; -} - std::unique_ptr<MatchingElements> GetDocsumsStateCallback::fill_matching_elements(const search::MatchingElementsFields& fields) { @@ -91,10 +88,10 @@ DocsumTools::obtainFieldNames(const FastS_VsmsummaryHandle &cfg) { uint32_t defaultSummaryId = getResultConfig()->LookupResultClassId(cfg->outputclass); _resultClass = getResultConfig()->LookupResultClass(defaultSummaryId); - if (_resultClass != NULL) { + if (_resultClass != nullptr) { for (uint32_t i = 0; i < _resultClass->GetNumEntries(); ++i) { const ResConfigEntry * entry = _resultClass->GetEntry(i); - _fieldSpecs.push_back(FieldSpec()); + _fieldSpecs.emplace_back(); _fieldSpecs.back().setOutputName(entry->_bindname); bool found = false; if (cfg) { diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h index c256264bbbf..ca7ead1afff 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h @@ -19,8 +19,6 @@ using search::docsummary::GetDocsumsState; using search::docsummary::IDocsumEnvironment; using search::docsummary::JuniperProperties; -using vespa::config::search::SummaryConfig; -using vespa::config::search::summary::JuniperrcConfig; namespace config { class ConfigSnapshot; } namespace vsm { @@ -38,12 +36,11 @@ public: GetDocsumsStateCallback(); void FillSummaryFeatures(GetDocsumsState& state) override; void FillRankFeatures(GetDocsumsState& state) override; - virtual void FillDocumentLocations(GetDocsumsState * state, IDocsumEnvironment * env); - virtual std::unique_ptr<search::MatchingElements> fill_matching_elements(const search::MatchingElementsFields& fields) override; + std::unique_ptr<search::MatchingElements> fill_matching_elements(const search::MatchingElementsFields& fields) override; void setSummaryFeatures(const search::FeatureSet::SP & sf) { _summaryFeatures = sf; } void setRankFeatures(const search::FeatureSet::SP & rf) { _rankFeatures = rf; } void set_matching_elements_filler(std::unique_ptr<IMatchingElementsFiller> matching_elements_filler); - ~GetDocsumsStateCallback(); + ~GetDocsumsStateCallback() override; }; class DocsumTools : public IDocsumEnvironment @@ -71,12 +68,12 @@ private: std::unique_ptr<juniper::Juniper> _juniper; const ResultClass * _resultClass; std::vector<FieldSpec> _fieldSpecs; - DocsumTools(const DocsumTools &); - DocsumTools &operator=(const DocsumTools &); public: DocsumTools(); - ~DocsumTools(); + DocsumTools(const DocsumTools &) = delete; + DocsumTools &operator=(const DocsumTools &) = delete; + ~DocsumTools() override; void set_writer(std::unique_ptr<DynamicDocsumWriter> writer); void setJuniper(std::unique_ptr<juniper::Juniper> juniper) { _juniper = std::move(juniper); } const ResultConfig *getResultConfig() const { return _writer->GetResultConfig(); } |