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

#pragma once

#include "direct_posting_store_adapter.h"
#include <vespa/vespalib/datastore/entryref.h>

namespace search::attribute {

/**
 * Adapter used to implement a specific IDirectPostingStore interface for
 * a string attribute vector with underlying posting lists (fast-search).
 */
template <typename ParentType, typename PostingStoreType, typename EnumStoreType>
class StringDirectPostingStoreAdapter : public DirectPostingStoreAdapter<ParentType, PostingStoreType, EnumStoreType> {
public:
    using LookupKey = typename ParentType::LookupKey;
    using LookupResult = typename ParentType::LookupResult;

    StringDirectPostingStoreAdapter(const PostingStoreType& posting_store,
                                    const EnumStoreType& enum_store,
                                    bool attr_is_filter);

    LookupResult lookup(const LookupKey& key,
                        vespalib::datastore::EntryRef dictionary_snapshot) const override;
    void collect_folded(vespalib::datastore::EntryRef enum_idx, vespalib::datastore::EntryRef dictionary_snapshot,
                        const std::function<void(vespalib::datastore::EntryRef)>& callback) const override;
    int64_t get_integer_value(vespalib::datastore::EntryRef enum_idx) const noexcept override;
};

}