blob: 2a3db3ec52de6ac4facac85d9e5b037df73ce2c9 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "blueprint.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vector>
namespace search::fef { class TermFieldMatchData; }
namespace search::queryeval {
class WeightedSetTermBlueprint : public ComplexLeafBlueprint
{
HitEstimate _estimate;
fef::MatchDataLayout _layout;
FieldSpec _children_field;
std::vector<int32_t> _weights;
std::vector<Blueprint::UP> _terms;
public:
WeightedSetTermBlueprint(const FieldSpec &field);
WeightedSetTermBlueprint(const WeightedSetTermBlueprint &) = delete;
WeightedSetTermBlueprint &operator=(const WeightedSetTermBlueprint &) = delete;
~WeightedSetTermBlueprint() override;
// used by create visitor
// matches signature in dot product blueprint for common blueprint
// building code. Hands out the same field spec to all children.
FieldSpec getNextChildField(const FieldSpec &) { return _children_field; }
// used by create visitor
void addTerm(Blueprint::UP term, int32_t weight);
SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override;
std::unique_ptr<MatchingElementsSearch> create_matching_elements_search(const MatchingElementsFields &fields) const override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
const vespalib::string &field_name() const { return _children_field.getName(); }
const std::vector<Blueprint::UP> &get_terms() const { return _terms; }
private:
void fetchPostings(const ExecuteInfo &execInfo) override;
};
}
|