blob: 370895dd94ffbd49c3d7479f492671fb52de341d (
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
|
// 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 <vespa/searchlib/fef/matchdatalayout.h>
namespace search::fef { class TermFieldMatchData; }
namespace search::queryeval {
class DotProductBlueprint : public ComplexLeafBlueprint
{
fef::MatchDataLayout _layout;
std::vector<int32_t> _weights;
std::vector<Blueprint::UP> _terms;
public:
explicit DotProductBlueprint(const FieldSpec &field);
DotProductBlueprint(const DotProductBlueprint &) = delete;
DotProductBlueprint &operator=(const DotProductBlueprint &) = delete;
~DotProductBlueprint() override;
// used by create visitor
FieldSpecBase getNextChildField(FieldSpecBase parent) {
return {parent.getFieldId(), _layout.allocTermField(parent.getFieldId()), false};
}
// used by create visitor
void reserve(size_t num_children);
void addTerm(Blueprint::UP term, int32_t weight, HitEstimate & estimate);
void complete(HitEstimate estimate) {
setEstimate(estimate);
}
void sort(InFlow in_flow, const Options &opts) override;
FlowStats calculate_flow_stats(uint32_t docid_limit) const override;
SearchIteratorUP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda) const override;
SearchIteratorUP createFilterSearch(FilterConstraint constraint) const override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
void fetchPostings(const ExecuteInfo &execInfo) override;
};
}
|