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

#include "matchdatalayout.h"
#include <cassert>

namespace search::fef {

MatchDataLayout::MatchDataLayout()
    : _numTermFields(0),
      _fieldIds()
{
}

MatchDataLayout::~MatchDataLayout() = default;


MatchData::UP
MatchDataLayout::createMatchData() const
{
    assert(_numTermFields == _fieldIds.size());
    auto md = std::make_unique<MatchData>(MatchData::params().numTermFields(_numTermFields));
    for (size_t i = 0; i < _numTermFields; ++i) {
        md->resolveTermField(i)->setFieldId(_fieldIds[i]);
    }
    return md;
}

}