aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/features/closest_feature.h
blob: 840f896abe2a665e490e59ca96e32b82d547d51b (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
// Copyright Yahoo. 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 <optional>

namespace search::features {

/**
 * Implements the blueprint for the closest executor.
 */
class ClosestBlueprint : public fef::Blueprint {
    vespalib::string                       _field_name;
    vespalib::eval::ValueType              _field_tensor_type;
    vespalib::eval::ValueType              _output_tensor_type;
    uint32_t                               _field_id;
    std::optional<vespalib::string>        _item_label;
    std::unique_ptr<vespalib::eval::Value> _empty_output;
    std::vector<char>                      _identity_space;
    vespalib::eval::TypedCells             _identity_cells;
public:
    ClosestBlueprint();
    ~ClosestBlueprint() override;
    void visitDumpFeatures(const fef::IIndexEnvironment & env, fef::IDumpFeatureVisitor & visitor) const override;
    std::unique_ptr<fef::Blueprint> createInstance() const override;
    fef::ParameterDescriptions getDescriptions() const override;
    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;
};

}