aboutsummaryrefslogtreecommitdiffstats
path: root/searchsummary/src/vespa/searchsummary/docsummary/getdocsumargs.h
blob: 5dbd2a05a6dd3d335d05a43072ca73c56671042e (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/searchlib/fef/properties.h>
#include <vespa/searchlib/engine/docsumrequest.h>
#include <vespa/vespalib/stllike/hash_set.h>

namespace search::docsummary {

class GetDocsumArgs
{
private:
    using FieldSet = vespalib::hash_set<vespalib::string>;
    vespalib::string   _resultClassName;
    bool               _dumpFeatures;
    bool               _locations_possible;
    std::vector<char>  _stackDump;
    vespalib::string   _location;
    vespalib::duration _timeout;
    fef::Properties    _highlightTerms;
    FieldSet           _fields;
public:
    GetDocsumArgs();
    GetDocsumArgs(const GetDocsumArgs &) = delete;
    GetDocsumArgs & operator=(const GetDocsumArgs &) = delete;
    ~GetDocsumArgs();

    void initFromDocsumRequest(const search::engine::DocsumRequest &req);

    void setResultClassName(vespalib::stringref name) { _resultClassName = name; }
    void setStackDump(uint32_t stackDumpLen, const char *stackDump);
    void locations_possible(bool value) { _locations_possible = value; }
    bool locations_possible() const { return _locations_possible; }
    const vespalib::string &getLocation() const { return _location; }
    void setLocation(const vespalib::string & location) { _location = location; }
    void setTimeout(vespalib::duration timeout) { _timeout = timeout; }
    vespalib::duration getTimeout() const { return _timeout; }

    const vespalib::string & getResultClassName()      const { return _resultClassName; }
    vespalib::stringref getStackDump() const {
        return {_stackDump.data(), _stackDump.size()};
    }

    void dumpFeatures(bool v) { _dumpFeatures = v; }
    bool dumpFeatures() const { return _dumpFeatures; }

    const fef::Properties &highlightTerms() const { return _highlightTerms; }
    void set_fields(const FieldSet& fields_in) { _fields = fields_in; }
    const FieldSet& get_fields() const { return _fields; }
    bool need_field(vespalib::stringref field) const;
};

}