aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchcommon/attribute/config.cpp
blob: 7c302a10731f2d3947b918f8be80268d21532afa (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "config.h"

namespace search::attribute {

namespace {

static constexpr uint64_t MAX_UNCOMMITTED_MEMORY = 8000;

}

Config::Config() noexcept
    : Config(BasicType::NONE, CollectionType::SINGLE, false)
{
}

Config::Config(BasicType bt, CollectionType ct, bool fastSearch_) noexcept
    : _basicType(bt),
      _type(ct),
      _fastSearch(fastSearch_),
      _isFilter(false),
      _fastAccess(false),
      _mutable(false),
      _paged(false),
      _distance_metric(DistanceMetric::Euclidean),
      _match(Match::UNCASED),
      _dictionary(),
      _maxUnCommittedMemory(MAX_UNCOMMITTED_MEMORY),
      _growStrategy(),
      _compactionStrategy(),
      _predicateParams(),
      _tensorType(vespalib::eval::ValueType::error_type()),
      _hnsw_index_params()
{
}

Config::Config(const Config &) = default;
Config & Config::operator = (const Config &) = default;
Config::Config(Config &&) noexcept = default;
Config & Config::operator = (Config &&) noexcept = default;
Config::~Config() = default;

bool
Config::operator==(const Config &b) const noexcept
{
    return _basicType == b._basicType &&
           _type == b._type &&
           _fastSearch == b._fastSearch &&
           _isFilter == b._isFilter &&
           _fastAccess == b._fastAccess &&
           _mutable == b._mutable &&
           _paged == b._paged &&
           _maxUnCommittedMemory == b._maxUnCommittedMemory &&
           _match == b._match &&
           _dictionary == b._dictionary &&
           _growStrategy == b._growStrategy &&
           _compactionStrategy == b._compactionStrategy &&
           _predicateParams == b._predicateParams &&
           (_basicType.type() != BasicType::Type::TENSOR ||
            _tensorType == b._tensorType) &&
            _distance_metric == b._distance_metric &&
            _hnsw_index_params == b._hnsw_index_params;
}

Config&
Config::set_hnsw_index_params(const HnswIndexParams& params) {
    assert(_distance_metric == params.distance_metric());
    _hnsw_index_params = params;
    return *this;
}

}