summaryrefslogtreecommitdiffstats
path: root/searchsummary/src/vespa/searchsummary/docsummary/summaryfeaturesdfw.h
blob: f1452d4c0a9ee3220be7c79e6916a78a9e9e83f0 (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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "docsumfieldwriter.h"

namespace vespalib { class JSONStringer; }

namespace search::docsummary {

class IDocsumEnvironment;

class FeaturesDFW : public IDocsumFW
{
protected:
    void featureDump(vespalib::JSONStringer & json, vespalib::stringref name, double feature);
};

class SummaryFeaturesDFW : public FeaturesDFW
{
private:
    SummaryFeaturesDFW(const SummaryFeaturesDFW &);
    SummaryFeaturesDFW & operator=(const SummaryFeaturesDFW &);

    IDocsumEnvironment * _env;

public:
    SummaryFeaturesDFW();
    ~SummaryFeaturesDFW() override;
    void init(IDocsumEnvironment * env);
    bool IsGenerated() const override { return true; }
    void insertField(uint32_t docid, GetDocsumsState *state,
                     ResType type, vespalib::slime::Inserter &target) override;
};

}