blob: a95ca0efc7222e4b778f3985acd6da46987f4cec (
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
88
89
90
91
92
93
94
95
96
97
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "blueprint.h"
#include "simpleresult.h"
#include "fake_result.h"
#include "searchable.h"
namespace search::queryeval {
//-----------------------------------------------------------------------------
class EmptyBlueprint : public SimpleLeafBlueprint
{
protected:
SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
EmptyBlueprint(FieldSpecBaseList fields);
EmptyBlueprint(FieldSpecBase field) : SimpleLeafBlueprint(field) {}
EmptyBlueprint() = default;
SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override;
};
class AlwaysTrueBlueprint : public SimpleLeafBlueprint
{
protected:
SearchIterator::UP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
AlwaysTrueBlueprint();
SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override;
};
//-----------------------------------------------------------------------------
class SimpleBlueprint : public SimpleLeafBlueprint
{
private:
vespalib::string _tag;
SimpleResult _result;
protected:
SearchIterator::UP
createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
SimpleBlueprint(const SimpleResult &result);
~SimpleBlueprint() override;
SimpleBlueprint &tag(const vespalib::string &tag);
const vespalib::string &tag() const { return _tag; }
SearchIterator::UP createFilterSearch(bool strict, FilterConstraint constraint) const override;
};
//-----------------------------------------------------------------------------
class FakeBlueprint : public SimpleLeafBlueprint
{
private:
vespalib::string _tag;
vespalib::string _term;
FieldSpec _field;
FakeResult _result;
std::unique_ptr<attribute::ISearchContext> _ctx;
protected:
SearchIterator::UP
createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
public:
FakeBlueprint(const FieldSpec &field, const FakeResult &result);
~FakeBlueprint() override;
FakeBlueprint &tag(const vespalib::string &t) {
_tag = t;
return *this;
}
const vespalib::string &tag() const { return _tag; }
FakeBlueprint &is_attr(bool value);
bool is_attr() const { return bool(_ctx); }
FakeBlueprint &term(const vespalib::string &t) {
_term = t;
return *this;
}
const attribute::ISearchContext *get_attribute_search_context() const noexcept final {
return _ctx.get();
}
SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override {
return create_default_filter(strict, constraint);
}
};
//-----------------------------------------------------------------------------
}
|