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
59
60
61
62
63
64
65
66
67
68
69
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "enumhintsearchcontext.h"
#include <vespa/searchlib/queryeval/emptysearch.h>
namespace search::attribute {
using queryeval::SearchIterator;
using btree::BTreeNode;
using fef::TermFieldMatchData;
EnumHintSearchContext::
EnumHintSearchContext(const EnumStoreDictBase &dictionary,
uint32_t docIdLimit,
uint64_t numValues)
: _dictionary(dictionary),
_frozenRootRef(dictionary.getFrozenRootRef()),
_uniqueValues(0u),
_docIdLimit(docIdLimit),
_numValues(numValues)
{
}
EnumHintSearchContext::~EnumHintSearchContext() = default;
void
EnumHintSearchContext::lookupTerm(const EnumStoreComparator &comp)
{
_uniqueValues = _dictionary.lookupFrozenTerm(_frozenRootRef, comp);
}
void
EnumHintSearchContext::lookupRange(const EnumStoreComparator &low, const EnumStoreComparator &high)
{
_uniqueValues = _dictionary.lookupFrozenRange(_frozenRootRef, low, high);
}
void
EnumHintSearchContext::fetchPostings(bool strict, const BitVector * filter)
{
(void) strict;
(void) filter;
}
SearchIterator::UP
EnumHintSearchContext::createPostingIterator(TermFieldMatchData *matchData, bool strict)
{
(void) matchData;
(void) strict;
return (_uniqueValues == 0u)
? SearchIterator::UP(new queryeval::EmptySearch())
: SearchIterator::UP();
}
unsigned int
EnumHintSearchContext::approximateHits() const
{
return (_uniqueValues == 0u)
? 0u
: std::max(uint64_t(_docIdLimit), _numValues);
}
}
|