aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/fef/matchdata.cpp
blob: fe77c8ed3bd8ad0c98f5814218d75f19a13aed2d (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 "matchdata.h"

namespace search {
namespace fef {

MatchData::MatchData(const Params &cparams)
    : _termFields(cparams.numTermFields()),
      _termwise_limit(1.0)
{
}

void
MatchData::soft_reset()
{
    for (auto &tfmd: _termFields) {
        tfmd.resetOnlyDocId(TermFieldMatchData::invalidId());
    }
    _termwise_limit = 1.0;
}

MatchData::UP
MatchData::makeTestInstance(uint32_t numTermFields, uint32_t fieldIdLimit)
{
    MatchData::UP data(new MatchData(Params().numTermFields(numTermFields)));
    for (uint32_t i = 0; i < numTermFields; ++i) {
        data->resolveTermField(i)->setFieldId(i % fieldIdLimit);
    }
    return data;
}

} // namespace fef
} // namespace search