From 067aba39c8877db69367b04bd05686772ab00554 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 30 Aug 2022 22:50:23 +0200 Subject: [PATCH 1/2] Use const IDocsumEnvironment reference in DocsumFieldWriterFactory. --- .../vespa/searchcore/proton/docsummary/summarymanager.h | 2 +- searchsummary/src/tests/docsummary/positionsdfw_test.cpp | 2 +- searchsummary/src/tests/juniper/testenv.cpp | 4 ++-- searchsummary/src/tests/juniper/testenv.h | 2 +- searchsummary/src/vespa/juniper/IJuniperProperties.h | 4 ++-- searchsummary/src/vespa/juniper/config.cpp | 2 +- searchsummary/src/vespa/juniper/config.h | 4 ++-- searchsummary/src/vespa/juniper/juniperparams.cpp | 2 +- searchsummary/src/vespa/juniper/juniperparams.h | 4 ++-- searchsummary/src/vespa/juniper/propreader.cpp | 2 +- searchsummary/src/vespa/juniper/propreader.h | 2 +- searchsummary/src/vespa/juniper/rpinterface.cpp | 4 ++-- searchsummary/src/vespa/juniper/rpinterface.h | 8 ++++---- .../docsummary/docsum_field_writer_factory.cpp | 2 +- .../docsummary/docsum_field_writer_factory.h | 6 +++--- .../src/vespa/searchsummary/docsummary/docsumconfig.h | 6 +++--- .../vespa/searchsummary/docsummary/dynamicteaserdfw.cpp | 2 +- .../vespa/searchsummary/docsummary/idocsumenvironment.h | 2 +- .../src/vespa/searchsummary/docsummary/juniperdfw.h | 8 ++++---- .../vespa/searchsummary/docsummary/juniperproperties.cpp | 2 +- .../vespa/searchsummary/docsummary/juniperproperties.h | 4 ++-- .../vespa/searchsummary/docsummary/keywordextractor.cpp | 2 +- .../src/vespa/searchsummary/docsummary/keywordextractor.h | 4 ++-- .../src/vespa/searchsummary/docsummary/rankfeaturesdfw.h | 2 -- .../vespa/searchsummary/docsummary/summaryfeaturesdfw.h | 2 -- .../src/vespa/vsm/vsm/docsum_field_writer_factory.cpp | 2 +- .../src/vespa/vsm/vsm/docsum_field_writer_factory.h | 2 +- streamingvisitors/src/vespa/vsm/vsm/docsumconfig.cpp | 2 +- streamingvisitors/src/vespa/vsm/vsm/docsumconfig.h | 2 +- streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h | 2 +- 30 files changed, 45 insertions(+), 49 deletions(-) diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index 44874e69b311..8be949a73518 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -45,7 +45,7 @@ class SummaryManager : public ISummaryManager const search::IAttributeManager * getAttributeManager() const override { return _attributeMgr.get(); } vespalib::string lookupIndex(const vespalib::string & s) const override { (void) s; return ""; } - juniper::Juniper * getJuniper() override { return _juniperConfig.get(); } + const juniper::Juniper * getJuniper() const override { return _juniperConfig.get(); } }; private: diff --git a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp index 0de84096e821..f2e949cbddfb 100644 --- a/searchsummary/src/tests/docsummary/positionsdfw_test.cpp +++ b/searchsummary/src/tests/docsummary/positionsdfw_test.cpp @@ -53,7 +53,7 @@ struct MyEnvironment : IDocsumEnvironment { const IAttributeManager *getAttributeManager() const override { return attribute_man; } string lookupIndex(const string &s) const override { return s; } - juniper::Juniper *getJuniper() override { return 0; } + const juniper::Juniper *getJuniper() const override { return nullptr; } }; class MyAttributeContext : public IAttributeContext { diff --git a/searchsummary/src/tests/juniper/testenv.cpp b/searchsummary/src/tests/juniper/testenv.cpp index 769c24b829c3..bb3522fe09ec 100644 --- a/searchsummary/src/tests/juniper/testenv.cpp +++ b/searchsummary/src/tests/juniper/testenv.cpp @@ -106,9 +106,9 @@ PropertyMap::set(const char *name, const char *value) const char * -PropertyMap::GetProperty(const char* name, const char* def) +PropertyMap::GetProperty(const char* name, const char* def) const { - std::map::iterator res = _map.find(std::string(name)); + std::map::const_iterator res = _map.find(std::string(name)); if (res != _map.end()) { return res->second.c_str(); } diff --git a/searchsummary/src/tests/juniper/testenv.h b/searchsummary/src/tests/juniper/testenv.h index a43f4a11bec9..f723fb966024 100644 --- a/searchsummary/src/tests/juniper/testenv.h +++ b/searchsummary/src/tests/juniper/testenv.h @@ -57,7 +57,7 @@ class PropertyMap : public IJuniperProperties PropertyMap(); ~PropertyMap(); PropertyMap &set(const char *name, const char *value); - const char* GetProperty(const char* name, const char* def = NULL) override; + const char* GetProperty(const char* name, const char* def = nullptr) const override; }; diff --git a/searchsummary/src/vespa/juniper/IJuniperProperties.h b/searchsummary/src/vespa/juniper/IJuniperProperties.h index 63ada17684c3..4902d3d561dd 100644 --- a/searchsummary/src/vespa/juniper/IJuniperProperties.h +++ b/searchsummary/src/vespa/juniper/IJuniperProperties.h @@ -15,7 +15,7 @@ class IJuniperProperties * @param def A default value for the property if not found in configuration * @return The value of the property or @param def if no such property is set */ - virtual const char* GetProperty(const char* name, const char* def = nullptr) = 0; + virtual const char* GetProperty(const char* name, const char* def = nullptr) const = 0; - virtual ~IJuniperProperties() {}; + virtual ~IJuniperProperties() = default; }; diff --git a/searchsummary/src/vespa/juniper/config.cpp b/searchsummary/src/vespa/juniper/config.cpp index a82a8d74b8a5..3daebfd1ea80 100644 --- a/searchsummary/src/vespa/juniper/config.cpp +++ b/searchsummary/src/vespa/juniper/config.cpp @@ -10,7 +10,7 @@ namespace juniper { -Config::Config(const char* config_name, Juniper & juniper) : +Config::Config(const char* config_name, const Juniper & juniper) : _docsumparams(), _matcherparams(), _sumconf(nullptr), diff --git a/searchsummary/src/vespa/juniper/config.h b/searchsummary/src/vespa/juniper/config.h index a9dabdd91d1b..51e2c67cfaeb 100644 --- a/searchsummary/src/vespa/juniper/config.h +++ b/searchsummary/src/vespa/juniper/config.h @@ -16,7 +16,7 @@ class Juniper; class Config { public: - Config(const char* config_name, Juniper & juniper); + Config(const char* config_name, const Juniper & juniper); ~Config(); const char* GetProp(const char* name, const char* def); @@ -26,7 +26,7 @@ class Config private: std::string _config_name; - Juniper & _juniper; + const Juniper& _juniper; Config(Config &); Config &operator=(Config &); diff --git a/searchsummary/src/vespa/juniper/juniperparams.cpp b/searchsummary/src/vespa/juniper/juniperparams.cpp index 2ee0f3c31f6c..e5a63440fd6f 100644 --- a/searchsummary/src/vespa/juniper/juniperparams.cpp +++ b/searchsummary/src/vespa/juniper/juniperparams.cpp @@ -102,7 +102,7 @@ size_t MatcherParams::StemMinLength() const { return _stem_min; } size_t MatcherParams::StemMaxExtend() const { return _stem_extend; } -MatcherParams& MatcherParams::SetWordFolder(Fast_WordFolder* wordfolder) +MatcherParams& MatcherParams::SetWordFolder(const Fast_WordFolder* wordfolder) { _wordfolder = wordfolder; return *this; diff --git a/searchsummary/src/vespa/juniper/juniperparams.h b/searchsummary/src/vespa/juniper/juniperparams.h index 415c254b3f0c..77422b026776 100644 --- a/searchsummary/src/vespa/juniper/juniperparams.h +++ b/searchsummary/src/vespa/juniper/juniperparams.h @@ -67,7 +67,7 @@ class MatcherParams MatcherParams& SetStemMaxExtend(size_t stem_extend); size_t StemMaxExtend() const; - MatcherParams& SetWordFolder(Fast_WordFolder* wordfolder); + MatcherParams& SetWordFolder(const Fast_WordFolder* wordfolder); const Fast_WordFolder* WordFolder() const noexcept { return _wordfolder; } MatcherParams& SetProximityFactor(double factor); @@ -79,7 +79,7 @@ class MatcherParams size_t _max_match_candidates; size_t _stem_min; size_t _stem_extend; - Fast_WordFolder* _wordfolder; // The wordfolder object needed as 1st parameter to folderfun + const Fast_WordFolder* _wordfolder; // The wordfolder object needed as 1st parameter to folderfun double _proximity_factor; }; diff --git a/searchsummary/src/vespa/juniper/propreader.cpp b/searchsummary/src/vespa/juniper/propreader.cpp index 99a6e580126e..bd20c885f6c4 100644 --- a/searchsummary/src/vespa/juniper/propreader.cpp +++ b/searchsummary/src/vespa/juniper/propreader.cpp @@ -80,7 +80,7 @@ void PropReader::Process(const char* filename) } -const char* PropReader::GetProperty(const char* name, const char* def) +const char* PropReader::GetProperty(const char* name, const char* def) const { const char* v = _keymap.Lookup(name, def); LOG(debug, "Parameter lookup :%s: value :%s:", name, v); diff --git a/searchsummary/src/vespa/juniper/propreader.h b/searchsummary/src/vespa/juniper/propreader.h index fbc6f53bfb19..45557716cd08 100644 --- a/searchsummary/src/vespa/juniper/propreader.h +++ b/searchsummary/src/vespa/juniper/propreader.h @@ -11,7 +11,7 @@ class PropReader : public IJuniperProperties { public: PropReader(const char* filename); - const char* GetProperty(const char* name, const char* def = NULL) override; + const char* GetProperty(const char* name, const char* def = nullptr) const override; void UpdateProperty(const char* name, const char* value); ~PropReader() {} protected: diff --git a/searchsummary/src/vespa/juniper/rpinterface.cpp b/searchsummary/src/vespa/juniper/rpinterface.cpp index c54ae654ec7e..202b96a442d8 100644 --- a/searchsummary/src/vespa/juniper/rpinterface.cpp +++ b/searchsummary/src/vespa/juniper/rpinterface.cpp @@ -73,12 +73,12 @@ Juniper::~Juniper() { } -std::unique_ptr Juniper::CreateConfig(const char* config_name) +std::unique_ptr Juniper::CreateConfig(const char* config_name) const { return std::unique_ptr(new Config(config_name, *this)); } -std::unique_ptr Juniper::CreateQueryHandle(const IQuery& fquery, const char* juniperoptions) +std::unique_ptr Juniper::CreateQueryHandle(const IQuery& fquery, const char* juniperoptions) const { return std::make_unique(fquery, juniperoptions, *_modifier); } diff --git a/searchsummary/src/vespa/juniper/rpinterface.h b/searchsummary/src/vespa/juniper/rpinterface.h index ee1f4e3a3d88..41a40e2c98df 100644 --- a/searchsummary/src/vespa/juniper/rpinterface.h +++ b/searchsummary/src/vespa/juniper/rpinterface.h @@ -96,8 +96,8 @@ class Juniper { */ ~Juniper(); - Fast_WordFolder & getWordFolder() { return *_wordfolder; } - IJuniperProperties & getProp() { return *_props; } + const Fast_WordFolder & getWordFolder() const noexcept { return *_wordfolder; } + const IJuniperProperties & getProp() const noexcept { return *_props; } QueryModifier & getModifier() { return *_modifier; } /** Create a result processing configuration of Juniper for subsequent use @@ -111,7 +111,7 @@ class Juniper { * NULL if an error occurred. */ - std::unique_ptr CreateConfig(const char* config_name = "juniper"); + std::unique_ptr CreateConfig(const char* config_name = "juniper") const; /** Allocate a query handle for the given query for subsequent calls to Analyse * for different hits. Performs the necessary per query processing for Juniper. * @param query A query to start result processing for. @@ -122,7 +122,7 @@ class Juniper { * to the query language. * @return A unique pointer to a QueryHandle. */ - std::unique_ptr CreateQueryHandle(const IQuery& query, const char* juniperoptions); + std::unique_ptr CreateQueryHandle(const IQuery& query, const char* juniperoptions) const; /** Add an rewriter for all terms that are prefixed with the given index. * When Juniper encounter a term in the query tagged with this index, diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp index cebfac4c86d0..b3fa6c68b87a 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.cpp @@ -19,7 +19,7 @@ using vespalib::IllegalArgumentException; namespace search::docsummary { -DocsumFieldWriterFactory::DocsumFieldWriterFactory(bool use_v8_geo_positions, IDocsumEnvironment& env) +DocsumFieldWriterFactory::DocsumFieldWriterFactory(bool use_v8_geo_positions, const IDocsumEnvironment& env) : _use_v8_geo_positions(use_v8_geo_positions), _env(env), _matching_elems_fields(std::make_shared()) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h index b4f28524eba3..bab7153009d9 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsum_field_writer_factory.h @@ -16,13 +16,13 @@ class IDocsumEnvironment; class DocsumFieldWriterFactory : public IDocsumFieldWriterFactory { bool _use_v8_geo_positions; - IDocsumEnvironment& _env; + const IDocsumEnvironment& _env; protected: std::shared_ptr _matching_elems_fields; - IDocsumEnvironment& getEnvironment() const noexcept { return _env; } + const IDocsumEnvironment& getEnvironment() const noexcept { return _env; } bool has_attribute_manager() const noexcept; public: - DocsumFieldWriterFactory(bool use_v8_geo_positions, IDocsumEnvironment& env); + DocsumFieldWriterFactory(bool use_v8_geo_positions, const IDocsumEnvironment& env); ~DocsumFieldWriterFactory() override; std::unique_ptr create_docsum_field_writer(const vespalib::string& fieldName, const vespalib::string& overrideName, const vespalib::string& argument, bool& rc) override; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.h b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.h index 40c4e134bbc7..2b0f90a8e8b6 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/docsumconfig.h @@ -16,7 +16,7 @@ class ResultConfig; class DynamicDocsumConfig { public: - DynamicDocsumConfig(IDocsumEnvironment& env, DynamicDocsumWriter * writer) : + DynamicDocsumConfig(const IDocsumEnvironment& env, DynamicDocsumWriter * writer) : _env(env), _writer(writer) { } @@ -24,12 +24,12 @@ class DynamicDocsumConfig void configure(const vespa::config::search::SummarymapConfig &cfg); protected: using string = vespalib::string; - IDocsumEnvironment& getEnvironment() { return _env; } + const IDocsumEnvironment& getEnvironment() { return _env; } const ResultConfig & getResultConfig() const; virtual std::unique_ptr make_docsum_field_writer_factory(); private: - IDocsumEnvironment& _env; + const IDocsumEnvironment& _env; DynamicDocsumWriter * _writer; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp index 24558dd97e8c..957f49c0f865 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/dynamicteaserdfw.cpp @@ -286,7 +286,7 @@ JuniperQueryAdapter::Traverse(juniper::IQueryVisitor *v) const return rc; } -JuniperDFW::JuniperDFW(juniper::Juniper * juniper) +JuniperDFW::JuniperDFW(const juniper::Juniper * juniper) : _input_field_name(), _juniperConfig(), _juniper(juniper) diff --git a/searchsummary/src/vespa/searchsummary/docsummary/idocsumenvironment.h b/searchsummary/src/vespa/searchsummary/docsummary/idocsumenvironment.h index 1e9f550ac6d4..8af35d9ce3aa 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/idocsumenvironment.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/idocsumenvironment.h @@ -14,7 +14,7 @@ class IDocsumEnvironment { public: virtual const search::IAttributeManager * getAttributeManager() const = 0; virtual vespalib::string lookupIndex(const vespalib::string & s) const = 0; - virtual juniper::Juniper * getJuniper() = 0; + virtual const juniper::Juniper * getJuniper() const = 0; virtual ~IDocsumEnvironment() = default; }; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h index 6a117fbc0cd4..63642ed75439 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperdfw.h @@ -20,12 +20,12 @@ class JuniperDFW : public DocsumFieldWriter const char *fieldName, const vespalib::string& inputField); protected: - explicit JuniperDFW(juniper::Juniper * juniper); + explicit JuniperDFW(const juniper::Juniper * juniper); ~JuniperDFW() override; vespalib::string _input_field_name; std::unique_ptr _juniperConfig; - juniper::Juniper *_juniper; + const juniper::Juniper *_juniper; private: bool IsGenerated() const override { return false; } JuniperDFW(const JuniperDFW &); @@ -39,7 +39,7 @@ class JuniperTeaserDFW : public JuniperDFW bool Init(const char *fieldName, const vespalib::string& inputField) override; protected: - explicit JuniperTeaserDFW(juniper::Juniper * juniper) : JuniperDFW(juniper) { } + explicit JuniperTeaserDFW(const juniper::Juniper * juniper) : JuniperDFW(juniper) { } }; @@ -49,7 +49,7 @@ class DynamicTeaserDFW : public JuniperTeaserDFW vespalib::stringref input, GetDocsumsState *state) const; public: - explicit DynamicTeaserDFW(juniper::Juniper * juniper) : JuniperTeaserDFW(juniper) { } + explicit DynamicTeaserDFW(const juniper::Juniper * juniper) : JuniperTeaserDFW(juniper) { } void insertField(uint32_t docid, const IDocsumStoreDocument* doc, GetDocsumsState *state, ResType type, vespalib::slime::Inserter &target) const override; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp index b795679c7e6a..8f6d6ed02ea1 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.cpp @@ -84,7 +84,7 @@ JuniperProperties::configure(const JuniperrcConfig &cfg) } const char * -JuniperProperties::GetProperty(const char *name, const char *def) +JuniperProperties::GetProperty(const char *name, const char *def) const { auto it = _properties.find(name); return it != _properties.end() ? it->second.c_str() : def; diff --git a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h index 55f2e572b9ba..88e819056cf8 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/juniperproperties.h @@ -26,7 +26,7 @@ class JuniperProperties : public IJuniperProperties { /** * Constructs a juniper property object with default values set. */ - JuniperProperties(const vespa::config::search::summary::JuniperrcConfig &cfg); + explicit JuniperProperties(const vespa::config::search::summary::JuniperrcConfig &cfg); ~JuniperProperties() override; @@ -38,7 +38,7 @@ class JuniperProperties : public IJuniperProperties { void configure(const vespa::config::search::summary::JuniperrcConfig &cfg); // Inherit doc from IJuniperProperties. - const char *GetProperty(const char *name, const char *def) override; + const char *GetProperty(const char *name, const char *def) const override; }; } diff --git a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp index 8b544eb09f67..8c0acda64e41 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.cpp @@ -17,7 +17,7 @@ bool useful(search::ParseItem::ItemCreator creator) } -KeywordExtractor::KeywordExtractor(IDocsumEnvironment * env) +KeywordExtractor::KeywordExtractor(const IDocsumEnvironment * env) : _env(env), _legalPrefixes(), _legalIndexes() diff --git a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h index 9d6905d66d46..74e9575b7c48 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/keywordextractor.h @@ -24,7 +24,7 @@ class KeywordExtractor private: typedef vespalib::hash_set Set; - IDocsumEnvironment *_env; + const IDocsumEnvironment *_env; std::vector _legalPrefixes; Set _legalIndexes; @@ -46,7 +46,7 @@ class KeywordExtractor } bool IsLegalIndexName(const char *idxName) const; public: - explicit KeywordExtractor(IDocsumEnvironment * env); + explicit KeywordExtractor(const IDocsumEnvironment * env); KeywordExtractor(const KeywordExtractor &) = delete; KeywordExtractor& operator=(const KeywordExtractor &) = delete; ~KeywordExtractor(); diff --git a/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h index 023d5ad158f1..7302d162b653 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/rankfeaturesdfw.h @@ -6,8 +6,6 @@ namespace search::docsummary { -class IDocsumEnvironment; - class RankFeaturesDFW : public SimpleDFW { public: diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h b/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h index fd1092f840a0..ec14dc45055c 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h +++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h @@ -6,8 +6,6 @@ namespace search::docsummary { -class IDocsumEnvironment; - class SummaryFeaturesDFW : public SimpleDFW { public: diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp index c7ca9b52dc94..35410f3ec678 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.cpp @@ -35,7 +35,7 @@ void populate_fields(MatchingElementsFields& fields, VsmfieldsConfig& fields_con } -DocsumFieldWriterFactory::DocsumFieldWriterFactory(bool use_v8_geo_positions, IDocsumEnvironment& env, const vespa::config::search::vsm::VsmfieldsConfig& vsm_fields_config) +DocsumFieldWriterFactory::DocsumFieldWriterFactory(bool use_v8_geo_positions, const IDocsumEnvironment& env, const vespa::config::search::vsm::VsmfieldsConfig& vsm_fields_config) : search::docsummary::DocsumFieldWriterFactory(use_v8_geo_positions, env), _vsm_fields_config(vsm_fields_config) { diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h index b8362c06f785..c06cb0454b35 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h +++ b/streamingvisitors/src/vespa/vsm/vsm/docsum_field_writer_factory.h @@ -16,7 +16,7 @@ class DocsumFieldWriterFactory : public search::docsummary::DocsumFieldWriterFac const vespa::config::search::vsm::VsmfieldsConfig& _vsm_fields_config; public: - DocsumFieldWriterFactory(bool use_v8_geo_positions, search::docsummary::IDocsumEnvironment& env, const vespa::config::search::vsm::VsmfieldsConfig& vsm_fields_config); + DocsumFieldWriterFactory(bool use_v8_geo_positions, const search::docsummary::IDocsumEnvironment& env, const vespa::config::search::vsm::VsmfieldsConfig& vsm_fields_config); ~DocsumFieldWriterFactory() override; std::unique_ptr create_docsum_field_writer(const vespalib::string& fieldName, const vespalib::string& overrideName, const vespalib::string& argument, bool& rc) override; diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.cpp b/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.cpp index 7525477fb525..59e56e657be9 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.cpp +++ b/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.cpp @@ -9,7 +9,7 @@ using vespa::config::search::vsm::VsmfieldsConfig; namespace vsm { -DynamicDocsumConfig::DynamicDocsumConfig(search::docsummary::IDocsumEnvironment& env, search::docsummary::DynamicDocsumWriter* writer, std::shared_ptr vsm_fields_config) +DynamicDocsumConfig::DynamicDocsumConfig(const search::docsummary::IDocsumEnvironment& env, search::docsummary::DynamicDocsumWriter* writer, std::shared_ptr vsm_fields_config) : Parent(env, writer), _vsm_fields_config(std::move(vsm_fields_config)) { diff --git a/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.h b/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.h index d5b7e2581657..760d493dbc1e 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.h +++ b/streamingvisitors/src/vespa/vsm/vsm/docsumconfig.h @@ -18,7 +18,7 @@ class DynamicDocsumConfig : public search::docsummary::DynamicDocsumConfig private: std::shared_ptr _vsm_fields_config; public: - DynamicDocsumConfig(search::docsummary::IDocsumEnvironment& env, search::docsummary::DynamicDocsumWriter* writer, std::shared_ptr vsm_fields_config); + DynamicDocsumConfig(const search::docsummary::IDocsumEnvironment& env, search::docsummary::DynamicDocsumWriter* writer, std::shared_ptr vsm_fields_config); private: std::unique_ptr make_docsum_field_writer_factory() override; }; diff --git a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h index b8583dc801da..d6c1f55d0921 100644 --- a/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h +++ b/streamingvisitors/src/vespa/vsm/vsm/vsm-adapter.h @@ -90,7 +90,7 @@ class DocsumTools : public IDocsumEnvironment // inherit doc from IDocsumEnvironment const search::IAttributeManager * getAttributeManager() const override { return nullptr; } vespalib::string lookupIndex(const vespalib::string&) const override { return ""; } - juniper::Juniper * getJuniper() override { return _juniper.get(); } + const juniper::Juniper * getJuniper() const override { return _juniper.get(); } }; typedef std::shared_ptr DocsumToolsPtr; From d3277ff41740acdc6a79cd61f043017e7504f931 Mon Sep 17 00:00:00 2001 From: Tor Egge Date: Tue, 30 Aug 2022 23:06:30 +0200 Subject: [PATCH 2/2] Use auto keyword. --- searchsummary/src/tests/juniper/testenv.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searchsummary/src/tests/juniper/testenv.cpp b/searchsummary/src/tests/juniper/testenv.cpp index bb3522fe09ec..cc6a64583769 100644 --- a/searchsummary/src/tests/juniper/testenv.cpp +++ b/searchsummary/src/tests/juniper/testenv.cpp @@ -108,7 +108,7 @@ PropertyMap::set(const char *name, const char *value) const char * PropertyMap::GetProperty(const char* name, const char* def) const { - std::map::const_iterator res = _map.find(std::string(name)); + auto res = _map.find(std::string(name)); if (res != _map.end()) { return res->second.c_str(); }