aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/vespa/searchcore/proton/feedoperation/lidvectorcontext.h
blob: b72c3a1d17246ec557a0016234c917082e1399ed (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 Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include <vespa/searchlib/query/base.h>
#include <vector>
#include <memory>

namespace vespalib { class nbostream; }

namespace proton {

class LidVectorContext
{
public:
    using LidVector = std::vector<search::DocumentIdT>;
private:
    LidVector _result;
    size_t    _docIdLimit;
    enum { ARRAY = 0, BITVECTOR = 1 };
public:
    using SP = std::shared_ptr<LidVectorContext>;
    LidVectorContext();
    LidVectorContext(size_t docIdLimit);
    LidVectorContext(size_t docIdLimit, const LidVector &lids);
    void addLid(const search::DocumentIdT lid);
    void serialize(vespalib::nbostream &os) const;
    void deserialize(vespalib::nbostream &is);
    const LidVector &getLidVector() const { return _result; }
    void clearLidVector() { _result.clear(); }
    size_t getDocIdLimit() const { return _docIdLimit; }
    size_t getNumLids() const { return _result.size(); }
};

}