blob: 257f63c937cb6f8cb811b235c94d6901dff68ea3 (
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
59
60
61
62
63
64
65
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchcommon/common/range.h>
#include <vespa/vespalib/stllike/string.h>
namespace search::fef { class TermFieldMatchData; }
namespace search::queryeval { class SearchIterator; }
namespace search {
class QueryTermBase;
class BitVector;
}
namespace search::attribute {
class ISearchContext {
public:
using UP = std::unique_ptr<ISearchContext>;
using DocId = uint32_t;
private:
virtual bool onCmp(DocId docId, int32_t &weight) const = 0;
virtual bool onCmp(DocId docId) const = 0;
public:
virtual ~ISearchContext() {}
virtual unsigned int approximateHits() const = 0;
/**
* Creates an attribute search iterator associated with this
* search context.
*
* @return attribute search iterator
*
* @param matchData the attribute match data used when
* unpacking data for a hit
*
* @param strict whether the iterator should be strict or not
**/
virtual std::unique_ptr<queryeval::SearchIterator>
createIterator(fef::TermFieldMatchData *matchData, bool strict) = 0;
/*
* Create temporary posting lists.
* Should be called before createIterator() is called.
* Will load/prepare any postings lists. Will take strictness and optional filter into account.
* @param strict If true iterator must advance to next valid docid.
* @param filter Any prefilter that can be applied to posting lists for optimization purposes.
*/
virtual void fetchPostings(bool strict, const BitVector * filter) = 0;
virtual bool valid() const = 0;
virtual Int64Range getAsIntegerTerm() const = 0;
virtual const QueryTermBase &queryTerm() const = 0;
virtual const vespalib::string &attributeName() const = 0;
bool cmp(DocId docId, int32_t &weight) const { return onCmp(docId, weight); }
bool cmp(DocId docId) const { return onCmp(docId); }
};
}
|