aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/features/firstphasefeature.cpp
blob: 3be1f157f591f835def62743aef89db9371d9ab8 (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
53
54
55
56
57
58
59
60
61
62
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "firstphasefeature.h"
#include <vespa/searchlib/fef/featureexecutor.h>
#include <vespa/searchlib/fef/indexproperties.h>
#include <vespa/searchlib/fef/properties.h>
#include <vespa/vespalib/util/stash.h>


using namespace search::fef;

namespace search::features {

void
FirstPhaseExecutor::execute(uint32_t)
{
    outputs().set_number(0, inputs().get_number(0));
}


FirstPhaseBlueprint::FirstPhaseBlueprint() :
    Blueprint("firstPhase")
{
    // empty
}

void
FirstPhaseBlueprint::visitDumpFeatures(const IIndexEnvironment &,
                                       IDumpFeatureVisitor & visitor) const
{
    // havardpe: dumping this is a really bad idea
    visitor.visitDumpFeature(getBaseName());
}

Blueprint::UP
FirstPhaseBlueprint::createInstance() const
{
    return std::make_unique<FirstPhaseBlueprint>();
}

bool
FirstPhaseBlueprint::setup(const IIndexEnvironment & env,
                           const ParameterList &)
{
    if (auto maybe_input = defineInput(indexproperties::rank::FirstPhase::lookup(env.getProperties()),
                                       AcceptInput::ANY))
    {
        describeOutput("score", "The ranking score for first phase.", maybe_input.value());
        return true;
    } else {
        return false;
    }
}

FeatureExecutor &
FirstPhaseBlueprint::createExecutor(const IQueryEnvironment &, vespalib::Stash &stash) const
{
    return stash.create<FirstPhaseExecutor>();
}


}