aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/queryeval/same_element_blueprint.h
blob: 1d7fc017f692b93a3ef756c84709496a790b2265 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

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

namespace search::fef { class TermFieldMatchData; }

namespace search::queryeval {

class SameElementSearch;

class SameElementBlueprint : public ComplexLeafBlueprint
{
private:
    HitEstimate                _estimate;
    fef::MatchDataLayout       _layout;
    std::vector<Blueprint::UP> _terms;
    vespalib::string           _field_name;

public:
    SameElementBlueprint(const FieldSpec &field, bool expensive);
    SameElementBlueprint(const SameElementBlueprint &) = delete;
    SameElementBlueprint &operator=(const SameElementBlueprint &) = delete;
    ~SameElementBlueprint() override;

    // no match data
    bool isWhiteList() const noexcept final { return true; }

    // used by create visitor
    FieldSpec getNextChildField(const vespalib::string &field_name, uint32_t field_id);

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

    void sort(InFlow in_flow) override;
    FlowStats calculate_flow_stats(uint32_t docid_limit) const override;
    
    void optimize_self(OptimizePass pass) override;
    void fetchPostings(const ExecuteInfo &execInfo) override;

    std::unique_ptr<SameElementSearch> create_same_element_search(search::fef::TermFieldMatchData& tfmd) const;
    SearchIteratorUP createLeafSearch(const search::fef::TermFieldMatchDataArray &tfmda) const override;
    SearchIteratorUP createFilterSearch(FilterConstraint constraint) const override;
    void visitMembers(vespalib::ObjectVisitor &visitor) const override;
    const std::vector<Blueprint::UP> &terms() const { return _terms; }
    const vespalib::string &field_name() const { return _field_name; }
};

}