blob: 53c2bf99aed6c62ec85d3a8df2a39d557404d697 (
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
63
64
65
66
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "wand_parts.h"
#include "weak_and_heap.h"
#include <vespa/searchlib/queryeval/blueprint.h>
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <memory>
#include <vector>
namespace search::queryeval {
const uint32_t DEFAULT_PARALLEL_WAND_SCORES_ADJUST_FREQUENCY = 4;
/**
* Blueprint for the parallel weak and search operator.
*/
class ParallelWeakAndBlueprint : public ComplexLeafBlueprint
{
private:
typedef wand::score_t score_t;
const FieldSpec _field;
mutable SharedWeakAndPriorityQueue _scores;
const wand::score_t _scoreThreshold;
double _thresholdBoostFactor;
const uint32_t _scoresAdjustFrequency;
HitEstimate _estimate;
fef::MatchDataLayout _layout;
std::vector<int32_t> _weights;
std::vector<Blueprint*> _terms;
ParallelWeakAndBlueprint(const ParallelWeakAndBlueprint &);
ParallelWeakAndBlueprint &operator=(const ParallelWeakAndBlueprint &);
public:
ParallelWeakAndBlueprint(const FieldSpec &field,
uint32_t scoresToTrack,
score_t scoreThreshold,
double thresholdBoostFactor);
ParallelWeakAndBlueprint(const FieldSpec &field,
uint32_t scoresToTrack,
score_t scoreThreshold,
double thresholdBoostFactor,
uint32_t scoresAdjustFrequency);
virtual ~ParallelWeakAndBlueprint();
const WeakAndHeap &getScores() const { return _scores; }
score_t getScoreThreshold() const { return _scoreThreshold; }
double getThresholdBoostFactor() const { return _thresholdBoostFactor; }
// Used by create visitor
FieldSpec getNextChildField(const FieldSpec &outer);
// Used by create visitor
void addTerm(Blueprint::UP term, int32_t weight);
SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
void visitMembers(vespalib::ObjectVisitor &visitor) const override;
void fetchPostings(bool strict, const BitVector * filter) override;
};
}
|