aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/attribute/attribute_type_matcher.cpp
blob: fad4955a43735483dda9eee56970619e34f1f861 (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 Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "attribute_type_matcher.h"
#include <vespa/searchcommon/attribute/config.h>

using search::attribute::BasicType;

namespace proton
{

bool
AttributeTypeMatcher::operator()(const search::attribute::Config &oldConfig, const search::attribute::Config &newConfig) const
{
    if ((oldConfig.basicType() != newConfig.basicType()) ||
        (oldConfig.collectionType() != newConfig.collectionType())) {
        return false;
    }
    if (newConfig.basicType().type() == BasicType::Type::TENSOR) {
        if (oldConfig.tensorType() != newConfig.tensorType()) {
            return false;
        }
    }
    if (newConfig.basicType().type() == BasicType::Type::PREDICATE) {
        using Params = search::attribute::PersistentPredicateParams;
        const Params &oldParams = oldConfig.predicateParams();
        const Params &newParams = newConfig.predicateParams();
        if (!(oldParams == newParams)) {
            return false;
        }
    }
    return true;
}

}