blob: a7e87ee86fce183e7b80b5cc3b41fde902aaa56a (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/searchcommon/attribute/i_search_context.h>
namespace search {
class AttributeVector;
class QueryTermSimple;
}
namespace search::queryeval { class SearchIterator; }
namespace search::attribute {
class IPostingListSearchContext;
/*
* SearchContext handles the creation of search iterators for a query term on an attribute vector.
* This is an abstract class.
*/
class SearchContext : public ISearchContext
{
protected:
using QueryTermSimpleUP = std::unique_ptr<QueryTermSimple>;
public:
SearchContext(const SearchContext&) = delete;
SearchContext(SearchContext&&) noexcept = default;
SearchContext& operator=(const SearchContext&) = delete;
SearchContext& operator=(SearchContext&&) noexcept = delete;
~SearchContext() override = default;
unsigned int approximateHits() const override;
std::unique_ptr<queryeval::SearchIterator> createIterator(fef::TermFieldMatchData* matchData, bool strict) override;
void fetchPostings(const queryeval::ExecuteInfo& execInfo) override;
bool valid() const override { return false; }
Int64Range getAsIntegerTerm() const override { return Int64Range(); }
DoubleRange getAsDoubleTerm() const override { return DoubleRange(); }
const QueryTermUCS4* queryTerm() const override {
return static_cast<const QueryTermUCS4*>(nullptr);
}
const vespalib::string& attributeName() const override;
const AttributeVector& attribute() const { return _attr; }
protected:
SearchContext(const AttributeVector& attr) noexcept
: _attr(attr),
_plsc(nullptr)
{}
const AttributeVector& _attr;
attribute::IPostingListSearchContext* _plsc;
/**
* Creates an attribute search iterator associated with this
* search context. Postings lists are not used.
**/
virtual std::unique_ptr<queryeval::SearchIterator> createFilterIterator(fef::TermFieldMatchData* matchData, bool strict);
bool getIsFilter() const;
};
}
|