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

#pragma once

#include <vector>
#include <cstdint>
#include <memory>
#include <vespa/searchlib/attribute/i_document_weight_attribute.h>

namespace search { class MatchingElements; }
namespace search::attribute { class IAttributeVector; }
namespace vespalib { template <typename> class ConstArrayRef; }
namespace vespalib::datastore { class EntryRef; }

namespace search::queryeval {

/*
 * Class used to find matching elements to limit what is returned in dynamic
 * summaries for summary fields where matched-elements-only is set.
 */
class MatchingElementsSearch {
protected:
    std::vector<uint32_t> _matching_elements;
public:
    MatchingElementsSearch();
    virtual ~MatchingElementsSearch();
    virtual void find_matching_elements(uint32_t doc_id, MatchingElements& result) = 0;
    virtual void initRange(uint32_t begin_id, uint32_t end_id) = 0;

    static std::unique_ptr<MatchingElementsSearch> create(const search::attribute::IAttributeVector &attr, vespalib::datastore::EntryRef dictionary_snapshot, vespalib::ConstArrayRef<IDocumentWeightAttribute::LookupResult> dict_entries);
};

}