aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/weighted_set_term_blueprint.h
blob: 6f5ac1038f49432682caae7150a55ac011a06fa5 (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 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "searchable.h"
#include <vespa/searchlib/fef/matchdatalayout.h>
#include <vector>

namespace search::fef { class TermFieldMatchData; }

namespace search::queryeval {

class WeightedSetTermBlueprint : public ComplexLeafBlueprint
{
    HitEstimate             _estimate;
    fef::MatchDataLayout    _layout;
    FieldSpec               _children_field;
    std::vector<int32_t>    _weights;
    std::vector<Blueprint*> _terms;

    WeightedSetTermBlueprint(const WeightedSetTermBlueprint &); // disabled
    WeightedSetTermBlueprint &operator=(const WeightedSetTermBlueprint &); // disabled

public:
    WeightedSetTermBlueprint(const FieldSpec &field);
    ~WeightedSetTermBlueprint();

    // used by create visitor
    // matches signature in dot product blueprint for common blueprint
    // building code. Hands out the same field spec to all children.
    FieldSpec getNextChildField(const FieldSpec &) { return _children_field; }

    // used by create visitor
    void addTerm(Blueprint::UP term, int32_t weight);

    SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
    void visitMembers(vespalib::ObjectVisitor &visitor) const override;

private:
    void fetchPostings(bool strict, const BitVector * filter) override;
};

}