blob: 922c8a81b2a427835ece343314fcb1b20002bb31 (
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
35
36
37
38
39
40
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include "simple_dfw.h"
#include <memory>
namespace search {
class IAttributeManager;
class MatchingElementsFields;
}
namespace search::attribute { class IAttributeVector; }
namespace search::docsummary {
/**
* Factory to create an DocsumFieldWriter to write an attribute vector to slime.
*/
class AttributeDFWFactory {
public:
static std::unique_ptr<DocsumFieldWriter> create(const IAttributeManager& attr_mgr,
const vespalib::string& attr_name,
bool filter_elements = false,
std::shared_ptr<MatchingElementsFields> matching_elems_fields = std::shared_ptr<MatchingElementsFields>());
};
class AttrDFW : public SimpleDFW
{
private:
vespalib::string _attrName;
protected:
const attribute::IAttributeVector& get_attribute(const GetDocsumsState& s) const;
const vespalib::string & getAttributeName() const override { return _attrName; }
public:
explicit AttrDFW(const vespalib::string & attrName);
bool isGenerated() const override { return true; }
};
}
|