blob: ffe292939d75f9176e778d315eb9939763ea8e96 (
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
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <vespa/searchlib/attribute/iattributemanager.h>
#include <vespa/searchlib/fef/iindexenvironment.h>
#include <vespa/searchlib/fef/iqueryenvironment.h>
#include <vespa/searchlib/fef/location.h>
#include <vespa/searchlib/fef/properties.h>
#include "indexenvironment.h"
namespace storage {
/**
* Implementation of the feature execution framework
* query environment API for the search visitor.
**/
class QueryEnvironment : public search::fef::IQueryEnvironment
{
private:
const IndexEnvironment &_indexEnv;
const search::fef::Properties &_properties;
search::attribute::IAttributeContext::UP _attrCtx;
std::vector<const search::fef::ITermData *> _queryTerms;
search::fef::Location _location;
public:
typedef std::unique_ptr<QueryEnvironment> UP;
QueryEnvironment(const vespalib::string & location,
const IndexEnvironment & indexEnv,
const search::fef::Properties & properties,
const search::IAttributeManager * attrMgr = NULL);
~QueryEnvironment();
// inherit documentation
virtual const search::fef::Properties & getProperties() const override { return _properties; }
// inherit documentation
virtual uint32_t getNumTerms() const override { return _queryTerms.size(); }
// inherit documentation
virtual const search::fef::ITermData *getTerm(uint32_t idx) const override {
if (idx >= _queryTerms.size()) {
return NULL;
}
return _queryTerms[idx];
}
// inherit documentation
virtual const search::fef::Location & getLocation() const override { return _location; }
// inherit documentation
virtual const search::attribute::IAttributeContext & getAttributeContext() const override { return *_attrCtx; }
// inherit documentation
virtual const search::fef::IIndexEnvironment & getIndexEnvironment() const override { return _indexEnv; }
void addTerm(const search::fef::ITermData *term) { _queryTerms.push_back(term); }
};
} // namespace storage
|