blob: d2b0438543f71571bf8ee47dc3e201edcc3d5c76 (
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 <vespa/searchlib/fef/blueprint.h>
#include <vespa/searchlib/query/weight.h>
#include <algorithm>
namespace search::features {
class NativeDotProductExecutor : public fef::FeatureExecutor
{
private:
using Pair = std::pair<fef::TermFieldHandle,query::Weight>;
std::vector<Pair> _pairs;
const fef::MatchData *_md;
void handle_bind_match_data(const fef::MatchData &md) override;
public:
NativeDotProductExecutor(const fef::IQueryEnvironment &env);
NativeDotProductExecutor(const fef::IQueryEnvironment &env, uint32_t fieldId);
void execute(uint32_t docId) override;
};
//-----------------------------------------------------------------------------
class NativeDotProductBlueprint : public fef::Blueprint
{
private:
const fef::FieldInfo *_field;
public:
NativeDotProductBlueprint() : Blueprint("nativeDotProduct"), _field(nullptr) {}
~NativeDotProductBlueprint() override;
void visitDumpFeatures(const fef::IIndexEnvironment &, fef::IDumpFeatureVisitor &) const override {}
fef::Blueprint::UP createInstance() const override {
return Blueprint::UP(new NativeDotProductBlueprint());
}
fef::ParameterDescriptions getDescriptions() const override {
return fef::ParameterDescriptions().desc().field().desc();
}
bool setup(const fef::IIndexEnvironment &env, const fef::ParameterList ¶ms) override;
fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;
};
}
|