aboutsummaryrefslogtreecommitdiffstats
path: root/storage/src/vespa/storageapi/message/queryresult.h
blob: c3bbbdc47ceae1dcb1b1b2d13de26c5e55343bc3 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "visitor.h"
#include <vespa/vdslib/container/searchresult.h>
#include <vespa/vdslib/container/documentsummary.h>

namespace storage {
namespace api {

/**
 * @class QueryResultCommand
 * @ingroup message
 *
 * @brief The result of a searchvisitor.
 */
class QueryResultCommand : public StorageCommand {
public:
    QueryResultCommand();

    void print(std::ostream& out, bool verbose, const std::string& indent) const override;

    const vdslib::SearchResult & getSearchResult() const { return _searchResult; }
    vdslib::SearchResult & getSearchResult() { return _searchResult; }
    const vdslib::DocumentSummary & getDocumentSummary() const { return _summary; }
    vdslib::DocumentSummary & getDocumentSummary() { return _summary; }

    DECLARE_STORAGECOMMAND(QueryResultCommand, onQueryResult)
private:
    vdslib::SearchResult    _searchResult;
    vdslib::DocumentSummary _summary;
};

/**
 * @class QueryResultReply
 * @ingroup message
 *
 * @brief Response to a search result command.
 */
class QueryResultReply : public StorageReply {
public:
    explicit QueryResultReply(const QueryResultCommand& command);
    void print(std::ostream& out, bool verbose, const std::string& indent) const override;
    DECLARE_STORAGEREPLY(QueryResultReply, onQueryResultReply)
};

} // api
} // storage