blob: 6e265e5dcb8f92bf4966569ae1aa4eda981339e6 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "logarithmcalculator.h"
#include <vespa/searchlib/fef/blueprint.h>
namespace search::features {
/**
* Implements the executor for the closeness feature.
*/
class ClosenessExecutor : public fef::FeatureExecutor {
private:
feature_t _maxDistance;
LogarithmCalculator _logCalc;
public:
ClosenessExecutor(feature_t maxDistance, feature_t scaleDistance);
void execute(uint32_t docId) override;
};
/**
* Implements the blueprint for the closeness executor.
*/
class ClosenessBlueprint : public fef::Blueprint {
private:
feature_t _maxDistance;
feature_t _scaleDistance;
feature_t _halfResponse;
vespalib::string _arg_string;
uint32_t _attr_id;
bool _use_geo_pos;
bool _use_nns_tensor;
bool _use_item_label;
public:
ClosenessBlueprint();
~ClosenessBlueprint() override;
void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override;
fef::Blueprint::UP createInstance() const override;
fef::ParameterDescriptions getDescriptions() const override {
return fef::ParameterDescriptions().desc().string().desc().string().string();
}
bool setup(const fef::IIndexEnvironment & env, const fef::ParameterList & params) override;
void prepareSharedState(const fef::IQueryEnvironment& env, fef::IObjectStore& store) const override;
fef::FeatureExecutor &createExecutor(const fef::IQueryEnvironment &env, vespalib::Stash &stash) const override;
};
}
|