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

#pragma once

#include "raw_attribute.h"
#include <vespa/vespalib/stllike/allocator.h>

namespace search::attribute {

/**
 * Attribute vector storing a single raw value per document in streaming search.
 */
class SingleRawExtAttribute : public RawAttribute,
                              public IExtendAttribute
{
    std::vector<char, vespalib::allocator_large<char>>         _buffer;
    std::vector<uint32_t, vespalib::allocator_large<uint32_t>> _offsets;
public:
    SingleRawExtAttribute(const vespalib::string& name);
    ~SingleRawExtAttribute() override;
    void onCommit() override;
    void onUpdateStat() override;
    bool addDoc(DocId& docId) override;
    bool add(vespalib::ConstArrayRef<char> v, int32_t) override;
    vespalib::ConstArrayRef<char> get_raw(DocId docid) const override;
    IExtendAttribute* getExtendInterface() override;
};

}