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

#pragma once

#include "multisearch.h"
#include <vespa/vespalib/util/priority_queue.h>
#include <vespa/searchlib/fef/matchdata.h>
#include <vespa/searchlib/fef/termfieldmatchdataarray.h>
#include <vespa/searchlib/attribute/iterator_pack.h>
#include <memory>
#include <vector>

namespace search::fef { class TermFieldMatchData; }

namespace search::queryeval {

class Blueprint;

/**
 * Search iterator for a weighted set, based on a set of child search
 * iterators.
 */
class WeightedSetTermSearch : public SearchIterator
{
protected:
    WeightedSetTermSearch() = default;

public:
    // TODO: pass ownership with unique_ptr
    static SearchIterator::UP create(const std::vector<SearchIterator *> &children,
                                     search::fef::TermFieldMatchData &tmd,
                                     bool field_is_filter,
                                     const std::vector<int32_t> &weights,
                                     fef::MatchData::UP match_data);

    static SearchIterator::UP create(search::fef::TermFieldMatchData &tmd,
                                     bool field_is_filter,
                                     const std::vector<int32_t> &weights,
                                     std::vector<DocumentWeightIterator> &&iterators);

    // used during docsum fetching to identify matching elements
    // initRange must be called before use.
    // doSeek/doUnpack must not be called.
    virtual void find_matching_elements(uint32_t docid, const std::vector<std::unique_ptr<Blueprint>> &child_blueprints, std::vector<uint32_t> &dst) = 0;
};

}