diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-01-25 11:18:52 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-01-25 11:18:52 +0100 |
commit | 4d59e63579de007b3470ec28f45185b8d5996f9e (patch) | |
tree | 22dcdac5447388d05e149c3e0181ad1636a7cac3 /searchcore | |
parent | db01dd9ebc4f63acc71d4ef9b015db4133a5de6d (diff) |
Propagate schema to summary manager.
Diffstat (limited to 'searchcore')
8 files changed, 48 insertions, 11 deletions
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index 0bcbf1269a1..ee6edf228d9 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -211,7 +211,7 @@ Fixture::initViewSet(ViewSet &views) auto matchView = std::make_shared<MatchView>(matchers, indexSearchable, attrMgr, _sessionMgr, metaStore, views._docIdLimit); views.searchView.set(SearchView::create (summaryMgr->createSummarySetup(SummaryConfig(), - JuniperrcConfig(), views.repo, attrMgr), + JuniperrcConfig(), views.repo, attrMgr, *schema), std::move(matchView))); views.feedView.set( make_shared<SearchableFeedView>(StoreOnlyFeedView::Context(summaryAdapter, @@ -684,6 +684,33 @@ TEST("require that subdbs should change if relevant config changed") TEST_DO(assertSubDbsShouldChange(CCR().set_alloc_config_changed(true))); } +void +assertSummaryManagerShouldNotChange(DocumentDBConfig::ComparisonResult result) +{ + ReconfigParams params(result); + EXPECT_FALSE(params.configHasChanged()); + EXPECT_FALSE(params.shouldSummaryManagerChange()); +} + +void +assertSummaryManagerShouldChange(DocumentDBConfig::ComparisonResult result) +{ + ReconfigParams params(result); + EXPECT_TRUE(params.configHasChanged()); + EXPECT_TRUE(params.shouldSummaryManagerChange()); +} + +TEST("require that summary manager should change if relevant config changed") +{ + TEST_DO(assertSummaryManagerShouldNotChange(CCR())); + TEST_DO(assertSummaryManagerShouldChange(CCR().setSummaryChanged(true))); + TEST_DO(assertSummaryManagerShouldChange(CCR().setJuniperrcChanged(true))); + TEST_DO(assertSummaryManagerShouldChange(CCR().setDocumenttypesChanged(true))); + TEST_DO(assertSummaryManagerShouldChange(CCR().setDocumentTypeRepoChanged(true))); + TEST_DO(assertSummaryManagerShouldChange(CCR().setStoreChanged(true))); + TEST_DO(assertSummaryManagerShouldChange(CCR().setSchemaChanged(true))); +} + TEST_MAIN() { TEST_RUN_ALL(); diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h index d392d817105..692326721e2 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/isummarymanager.h @@ -9,6 +9,7 @@ #include <vespa/searchsummary/docsummary/resultconfig.h> namespace document { class DocumentTypeRepo; } +namespace search::index { class Schema; } namespace proton { @@ -46,7 +47,8 @@ public: createSummarySetup(const SummaryConfig &summaryCfg, const JuniperrcConfig &juniperCfg, const std::shared_ptr<const document::DocumentTypeRepo> &repo, - const std::shared_ptr<search::IAttributeManager> &attributeMgr) = 0; + const std::shared_ptr<search::IAttributeManager> &attributeMgr, + const search::index::Schema& schema) = 0; virtual search::IDocumentStore &getBackingStore() = 0; protected: diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp index 34ba0e70c25..2b3a3de3b45 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp @@ -83,7 +83,8 @@ SummaryManager::SummarySetup:: SummarySetup(const vespalib::string & baseDir, const SummaryConfig & summaryCfg, const JuniperrcConfig & juniperCfg, search::IAttributeManager::SP attributeMgr, search::IDocumentStore::SP docStore, - std::shared_ptr<const DocumentTypeRepo> repo) + std::shared_ptr<const DocumentTypeRepo> repo, + const search::index::Schema& schema) : _docsumWriter(), _wordFolder(std::make_unique<Fast_NormalizeWordFolder>()), _juniperProps(juniperCfg), @@ -94,6 +95,7 @@ SummarySetup(const vespalib::string & baseDir, const SummaryConfig & summaryCfg, { _juniperConfig = std::make_unique<juniper::Juniper>(&_juniperProps, _wordFolder.get()); auto resultConfig = std::make_unique<ResultConfig>(); + (void) schema; std::unique_ptr<IKeywordExtractorFactory> keyword_extractor_factory = std::make_unique<LegacyKeywordExtractorFactory>(std::shared_ptr<IKeywordExtractor>()); auto docsum_field_writer_factory = std::make_unique<DocsumFieldWriterFactory>(summaryCfg.usev8geopositions, *this, *keyword_extractor_factory); if (!resultConfig->readConfig(summaryCfg, make_string("SummaryManager(%s)", baseDir.c_str()).c_str(), @@ -120,10 +122,11 @@ SummaryManager::SummarySetup::createDocsumStore() ISummaryManager::ISummarySetup::SP SummaryManager::createSummarySetup(const SummaryConfig & summaryCfg, const JuniperrcConfig & juniperCfg, const std::shared_ptr<const DocumentTypeRepo> &repo, - const search::IAttributeManager::SP &attributeMgr) + const search::IAttributeManager::SP &attributeMgr, + const search::index::Schema& schema) { return std::make_shared<SummarySetup>(_baseDir, summaryCfg, - juniperCfg, attributeMgr, _docStore, repo); + juniperCfg, attributeMgr, _docStore, repo, schema); } SummaryManager::SummaryManager(vespalib::Executor &shared_executor, const LogDocumentStore::Config & storeConfig, diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h index bd6d8240df0..a987d40fe6d 100644 --- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h +++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.h @@ -35,7 +35,8 @@ public: const JuniperrcConfig & juniperCfg, search::IAttributeManager::SP attributeMgr, search::IDocumentStore::SP docStore, - std::shared_ptr<const document::DocumentTypeRepo> repo); + std::shared_ptr<const document::DocumentTypeRepo> repo, + const search::index::Schema& schema); search::docsummary::IDocsumWriter & getDocsumWriter() const override { return *_docsumWriter; } const search::docsummary::ResultConfig & getResultConfig() override { return *_docsumWriter->GetResultConfig(); } @@ -71,7 +72,8 @@ public: createSummarySetup(const SummaryConfig &summaryCfg, const JuniperrcConfig &juniperCfg, const std::shared_ptr<const document::DocumentTypeRepo> &repo, - const search::IAttributeManager::SP &attributeMgr) override; + const search::IAttributeManager::SP &attributeMgr, + const search::index::Schema& schema) override; search::IDocumentStore & getBackingStore() override { return *_docStore; } void reconfigure(const search::LogDocumentStore::Config & config); diff --git a/searchcore/src/vespa/searchcore/proton/server/reconfig_params.cpp b/searchcore/src/vespa/searchcore/proton/server/reconfig_params.cpp index 2705ef24455..526a6fd1cd4 100644 --- a/searchcore/src/vespa/searchcore/proton/server/reconfig_params.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/reconfig_params.cpp @@ -59,7 +59,7 @@ bool ReconfigParams::shouldSummaryManagerChange() const { return _res.summaryChanged || _res.juniperrcChanged - || _res.documentTypeRepoChanged || _res.documenttypesChanged || _res.storeChanged; + || _res.documentTypeRepoChanged || _res.documenttypesChanged || _res.storeChanged || _res.schemaChanged; } bool diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp index 38487460b93..8ff55265a8b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp @@ -221,7 +221,8 @@ SearchableDocSubDBConfigurer::reconfigure(const DocumentDBConfig &newConfig, sumMgr->createSummarySetup(newConfig.getSummaryConfig(), newConfig.getJuniperrcConfig(), newConfig.getDocumentTypeRepoSP(), - attrMgr); + attrMgr, + *newConfig.getSchemaSP()); sumSetup = newSumSetup; shouldSearchViewChange = true; } diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index 3d87e7dc7c3..506b541bbd3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -203,7 +203,8 @@ SearchableDocSubDB::initViews(const DocumentDBConfig &configSnapshot) configSnapshot.getSummaryConfig(), configSnapshot.getJuniperrcConfig(), configSnapshot.getDocumentTypeRepoSP(), - attrMgr), + attrMgr, + *configSnapshot.getSchemaSP()), std::move(matchView))); auto attrWriter = std::make_shared<AttributeWriter>(attrMgr); 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 a40d89d6edf..d69d2dfd8eb 100644 --- a/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h +++ b/searchcore/src/vespa/searchcore/proton/test/dummy_summary_manager.h @@ -11,7 +11,8 @@ struct DummySummaryManager : public ISummaryManager createSummarySetup(const SummaryConfig &, const JuniperrcConfig &, const std::shared_ptr<const document::DocumentTypeRepo> &, - const std::shared_ptr<search::IAttributeManager> &) override { + const std::shared_ptr<search::IAttributeManager> &, + const search::index::Schema&) override { return {}; } }; |