aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/dot_product_blueprint.h
blob: e19a6cdb7f9f37a7b7acf449f8f7d7a156af4a72 (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
// 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>

namespace search::fef { class TermFieldMatchData; }

namespace search::queryeval {

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

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

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

    // used by create visitor
    FieldSpec getNextChildField(const FieldSpec &outer);

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

    SearchIteratorUP
    createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda,
                     bool strict) const override;

    void visitMembers(vespalib::ObjectVisitor &visitor) const override;
    void fetchPostings(bool strict) override;
};

}