blob: eab88624e325fae97cb45fabdf828fd30ea78b37 (
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchlib/fef/iqueryenvironment.h>
#include <vespa/searchlib/fef/properties.h>
namespace search::index { class IFieldLengthInspector; }
namespace proton::matching {
/**
* Query environment implementation for the proton matching pipeline.
**/
class QueryEnvironment : public search::fef::IQueryEnvironment
{
private:
const search::fef::IIndexEnvironment &_indexEnv;
const search::attribute::IAttributeContext &_attrContext;
search::fef::Properties _properties;
GeoLocationSpecPtrs _locations;
std::vector<const search::fef::ITermData *> _terms;
const search::index::IFieldLengthInspector &_field_length_inspector;
QueryEnvironment(const QueryEnvironment &);
QueryEnvironment &operator=(const QueryEnvironment &);
public:
/**
* Set up a new query environment.
*
* @param indexEnv index environment; referenced, not copied
* @param attrContext attribute context; referenced, not copied
* @param properties properties; copied
**/
QueryEnvironment(const search::fef::IIndexEnvironment &indexEnv,
const search::attribute::IAttributeContext &attrContext,
const search::fef::Properties &properties,
const search::index::IFieldLengthInspector &field_length_inspector);
/**
* Used to edit the list of terms by the one setting up this query
* environment.
*
* @return modifiable list of terms data pointers
**/
std::vector<const search::fef::ITermData *> &terms() { return _terms; }
/**
* Used to edit the list of locations by the one setting up this
* query environment.
*
* Initially, only the first location in this list is made
* available through the IQueryEnvironment interface.
*
* @return modifiable list of location data pointers
**/
GeoLocationSpecPtrs &locations() {
return _locations;
}
// inherited from search::fef::IQueryEnvironment
const search::fef::Properties &getProperties() const override;
// inherited from search::fef::IQueryEnvironment
uint32_t getNumTerms() const override;
// inherited from search::fef::IQueryEnvironment
const search::fef::ITermData *getTerm(uint32_t idx) const override;
// inherited from search::fef::IQueryEnvironment
GeoLocationSpecPtrs getAllLocations() const override {
return _locations;
}
// inherited from search::fef::IQueryEnvironment
const search::attribute::IAttributeContext & getAttributeContext() const override;
double get_average_field_length(const vespalib::string &field_name) const override;
// inherited from search::fef::IQueryEnvironment
const search::fef::IIndexEnvironment & getIndexEnvironment() const override;
~QueryEnvironment() override;
};
}
|