blob: a561adf5b429ebd7beae5e60364ca0882010bfb7 (
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
|
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "wand_term.h"
#include <vespa/searchlib/fef/itermdata.h>
#include <vespa/searchlib/fef/matchdata.h>
using search::fef::ITermData;
using search::fef::MatchData;
namespace search::streaming {
WandTerm::WandTerm(std::unique_ptr<QueryNodeResultBase> result_base, const string & index, uint32_t num_terms)
: DotProductTerm(std::move(result_base), index, num_terms),
_score_threshold(0.0)
{
}
WandTerm::~WandTerm() = default;
bool
WandTerm::evaluate() const
{
if (_score_threshold <= 0.0) {
return DotProductTerm::evaluate();
}
Scores scores;
build_scores(scores);
for (auto &field_and_score : scores) {
if (field_and_score.second > _score_threshold) {
return true;
}
}
return false;
}
void
WandTerm::unpack_match_data(uint32_t docid, const ITermData& td, MatchData& match_data)
{
Scores scores;
build_scores(scores);
unpack_scores(scores, _score_threshold, docid, td, match_data);
}
}
|