aboutsummaryrefslogtreecommitdiffstats
path: root/documentapi/src/vespa/documentapi/messagebus/messages/queryresultmessage.cpp
blob: 4948fd7bc4dc92dffc90a674f397f74b8f361059 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "queryresultmessage.h"

namespace documentapi {

QueryResultMessage::QueryResultMessage() = default;

QueryResultMessage::QueryResultMessage(vdslib::SearchResult && result, const vdslib::DocumentSummary & summary) :
    VisitorMessage(),
    _searchResult(std::move(result)),
    _summary(summary)
{}

QueryResultMessage::~QueryResultMessage() = default;

DocumentReply::UP
QueryResultMessage::doCreateReply() const
{
    return std::make_unique<VisitorReply>(DocumentProtocol::REPLY_QUERYRESULT);
}

uint32_t
QueryResultMessage::getApproxSize() const
{
    return getSearchResult().getSerializedSize() + getDocumentSummary().getSerializedSize();
}

uint32_t
QueryResultMessage::getType() const
{
    return DocumentProtocol::MESSAGE_QUERYRESULT;
}

}