aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp
blob: 2777d3b3fb88e0a31fb6bfeae3f09e7e8cd3b629 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "documentdb_config_builder.h"
#include <vespa/config-summary.h>
#include <vespa/config-rank-profiles.h>
#include <vespa/config-attributes.h>
#include <vespa/config-indexschema.h>
#include <vespa/document/config/documenttypes_config_fwd.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/searchsummary/config/config-juniperrc.h>
#include <vespa/document/config/config-documenttypes.h>
#include <vespa/config-imported-fields.h>
#include <vespa/searchcore/proton/common/alloc_config.h>
#include <vespa/searchcore/proton/server/threading_service_config.h>

using search::TuneFileDocumentDB;
using search::index::Schema;
using vespa::config::search::RankProfilesConfig;
using vespa::config::search::IndexschemaConfig;
using vespa::config::search::AttributesConfig;
using vespa::config::search::SummaryConfig;
using vespa::config::search::summary::JuniperrcConfig;
using vespa::config::search::ImportedFieldsConfig;
using proton::ThreadingServiceConfig;

namespace proton::test {

DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation,
                                                 const search::index::Schema::SP &schema,
                                                 const vespalib::string &configId,
                                                 const vespalib::string &docTypeName)
    : _generation(generation),
      _rankProfiles(std::make_shared<RankProfilesConfig>()),
      _rankingConstants(std::make_shared<search::fef::RankingConstants>()),
      _rankingExpressions(std::make_shared<search::fef::RankingExpressions>()),
      _onnxModels(std::make_shared<search::fef::OnnxModels>()),
      _indexschema(std::make_shared<IndexschemaConfig>()),
      _attributes(std::make_shared<AttributesConfig>()),
      _summary(std::make_shared<SummaryConfig>()),
      _juniperrc(std::make_shared<JuniperrcConfig>()),
      _documenttypes(std::make_shared<DocumenttypesConfig>()),
      _repo(std::make_shared<document::DocumentTypeRepo>()),
      _importedFields(std::make_shared<ImportedFieldsConfig>()),
      _tuneFileDocumentDB(std::make_shared<TuneFileDocumentDB>()),
      _schema(schema),
      _maintenance(std::make_shared<DocumentDBMaintenanceConfig>()),
      _store(),
      _threading_service_config(ThreadingServiceConfig::make()),
      _alloc_config(AllocConfig::makeDefault()),
      _configId(configId),
      _docTypeName(docTypeName)
{ }


DocumentDBConfigBuilder::DocumentDBConfigBuilder(const DocumentDBConfig &cfg)
    : _generation(cfg.getGeneration()),
      _rankProfiles(cfg.getRankProfilesConfigSP()),
      _rankingConstants(cfg.getRankingConstantsSP()),
      _rankingExpressions(cfg.getRankingExpressionsSP()),
      _onnxModels(cfg.getOnnxModelsSP()),
      _indexschema(cfg.getIndexschemaConfigSP()),
      _attributes(cfg.getAttributesConfigSP()),
      _summary(cfg.getSummaryConfigSP()),
      _juniperrc(cfg.getJuniperrcConfigSP()),
      _documenttypes(cfg.getDocumenttypesConfigSP()),
      _repo(cfg.getDocumentTypeRepoSP()),
      _importedFields(cfg.getImportedFieldsConfigSP()),
      _tuneFileDocumentDB(cfg.getTuneFileDocumentDBSP()),
      _schema(cfg.getSchemaSP()),
      _maintenance(cfg.getMaintenanceConfigSP()),
      _store(cfg.getStoreConfig()),
      _threading_service_config(cfg.get_threading_service_config()),
      _alloc_config(cfg.get_alloc_config()),
      _configId(cfg.getConfigId()),
      _docTypeName(cfg.getDocTypeName())
{}

DocumentDBConfigBuilder::~DocumentDBConfigBuilder() = default;

DocumentDBConfig::SP
DocumentDBConfigBuilder::build()
{
    return std::make_shared<DocumentDBConfig>(
            _generation,
            _rankProfiles,
            _rankingConstants,
            _rankingExpressions,
            _onnxModels,
            _indexschema,
            _attributes,
            _summary,
            _juniperrc,
            _documenttypes,
            _repo,
            _importedFields,
            _tuneFileDocumentDB,
            _schema,
            _maintenance,
            _store,
            _threading_service_config,
            _alloc_config,
            _configId,
            _docTypeName);
}

}