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

#include <vespa/searchlib/common/matching_elements.h>
#include <vespa/searchsummary/docsummary/docsumstate.h>

namespace search::docsummary::test {

class MockStateCallback : public GetDocsumsStateCallback {
private:
    MatchingElements _matching_elems;

public:
    MockStateCallback()
        : GetDocsumsStateCallback(),
          _matching_elems()
    {
    }
    ~MockStateCallback() override { }
    void fillSummaryFeatures(GetDocsumsState&) override { }
    void fillRankFeatures(GetDocsumsState&) override { }
    std::unique_ptr<MatchingElements> fill_matching_elements(const search::MatchingElementsFields&) override {
        return std::make_unique<MatchingElements>(_matching_elems);
    }

    void add_matching_elements(uint32_t docid, const vespalib::string& field_name,
                               const std::vector<uint32_t>& elements) {
        _matching_elems.add_matching_elements(docid, field_name, elements);
    }
    void clear() {
        _matching_elems = MatchingElements();
    }
};

}