blob: 0de9be332facbabeac17d58f1ee5cbc8130c0171 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <memory>
#include <cstdint>
#define VESPA_DLL_LOCAL __attribute__ ((visibility("hidden")))
/**
* Interface for posting lists used by PredicateSearch.
*/
namespace search::predicate {
class PredicatePostingList {
uint32_t _docId;
uint64_t _subquery;
protected:
PredicatePostingList()
: _docId(0),
_subquery(UINT64_MAX)
{ }
void setDocId(uint32_t docId) { _docId = docId; }
public:
using UP = std::unique_ptr<PredicatePostingList>;
virtual ~PredicatePostingList() = default;
/*
* Moves to next document after the one supplied.
* Returns false if there were no more doc ids.
*/
virtual bool next(uint32_t docId) = 0;
/*
* Moves to the next interval within the current doc id.
* Returns false if there were no more intervals for the current doc id.
*/
virtual bool nextInterval() = 0;
uint32_t getDocId() const { return _docId; }
VESPA_DLL_LOCAL virtual uint32_t getInterval() const = 0;
// Comes from the query that triggered inclusion of this posting list.
void setSubquery(uint64_t subquery) { _subquery = subquery; }
uint64_t getSubquery() const { return _subquery; }
};
}
|