blob: 4a65f7251beb4de85c9512269e8113bda7005d9f (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "attributeguard.h"
#include "sourceselector.h"
namespace search {
class FixedSourceSelector : public SourceSelector
{
private:
SourceStore & _source;
queryeval::Source getSource(uint32_t docId) const {
return _source.getFast(docId);
}
void reserve(uint32_t numDocs);
using IIterator = queryeval::sourceselector::Iterator;
public:
using UP = std::unique_ptr<FixedSourceSelector>;
class Iterator : public IIterator {
private:
AttributeGuard _attributeGuard;
public:
Iterator(const FixedSourceSelector & sourceSelector);
};
public:
FixedSourceSelector(queryeval::Source defaultSource,
const vespalib::string & attrBaseFileName,
uint32_t initialNumDocs = 0);
~FixedSourceSelector() override;
FixedSourceSelector::UP cloneAndSubtract(const vespalib::string & attrBaseFileName, uint32_t diff);
static FixedSourceSelector::UP load(const vespalib::string & baseFileName, uint32_t currentId);
// Inherit doc from ISourceSelector
void setSource(uint32_t docId, queryeval::Source source) final override;
uint32_t getDocIdLimit() const final override {
return _source.getCommittedDocIdLimit() - 1;
}
void compactLidSpace(uint32_t lidLimit) override;
std::unique_ptr<IIterator> createIterator() const final override {
return std::make_unique<Iterator>(*this);
}
};
} // namespace search
|