blob: ec5c145eed56df7da2448eead11d721de8ebbea7 (
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.
#pragma once
#include <vespa/vespalib/stllike/string.h>
#include <utility>
#include <map>
#include <vector>
#include <memory>
namespace search {
/**
* Keeps track of which elements matched the query for a set of fields
* across multiple documents.
**/
class MatchingElements
{
private:
using key_t = std::pair<uint32_t, vespalib::string>;
using value_t = std::vector<uint32_t>;
std::map<key_t, value_t> _map;
public:
MatchingElements();
~MatchingElements();
using UP = std::unique_ptr<MatchingElements>;
void add_matching_elements(uint32_t docid, const vespalib::string &field_name, const std::vector<uint32_t> &elements);
const std::vector<uint32_t> &get_matching_elements(uint32_t docid, const vespalib::string &field_name) const;
};
} // namespace search
|