aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/fef/test/indexenvironmentbuilder.cpp
blob: 3b1e94cbb3accd19137c157aa58abde35188b31d (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "indexenvironmentbuilder.h"
#include <vespa/searchcommon/common/datatype.h>

namespace search::fef::test {

IndexEnvironmentBuilder::IndexEnvironmentBuilder(IndexEnvironment &env) :
    _env(env)
{
}

IndexEnvironmentBuilder &
IndexEnvironmentBuilder::addField(const FieldType &type,
                                  const FieldInfo::CollectionType &coll,
                                  const vespalib::string &name)
{
    return addField(type, coll, FieldInfo::DataType::DOUBLE, name);
}

IndexEnvironmentBuilder &
IndexEnvironmentBuilder::addField(const FieldType &type,
                                  const FieldInfo::CollectionType &coll,
                                  const FieldInfo::DataType &dataType,
                                  const vespalib::string &name)
{
    uint32_t idx = _env.getFields().size();
    FieldInfo field(type, coll, name, idx);
    field.set_data_type(dataType);
    _env.getFields().push_back(field);
    return *this;
}

}