aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/diskindex/docidmapper.cpp
blob: 1bd79166a5108faf81fe1e0646bc7515bec36ca5 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "docidmapper.h"
#include <vespa/searchlib/common/documentsummary.h>

#define NO_DOC static_cast<uint32_t>(-1)

namespace search::diskindex {

DocIdMapping::DocIdMapping()
    : _selector(nullptr),
      _docIdLimit(0u),
      _selectorId(0)
{
}


void
DocIdMapping::clear()
{
    _docIdLimit = 0;
    _selector = nullptr;
    _selectorId = 0;
}


void
DocIdMapping::setup(uint32_t docIdLimit)
{
    _docIdLimit = docIdLimit;
    _selector = nullptr;
    _selectorId = 0;
}


void
DocIdMapping::setup(uint32_t docIdLimit, const SelectorArray *selector, uint8_t selectorId)
{
    _docIdLimit = docIdLimit;
    _selector = selector;
    _selectorId = selectorId;
}


bool
DocIdMapping::readDocIdLimit(const vespalib::string &mergedDir)
{
    uint32_t docIdLimit = 0;
    if (!search::docsummary::DocumentSummary::readDocIdLimit(mergedDir, docIdLimit)) {
        return false;
    }
    _docIdLimit = docIdLimit;
    return true;
}



}