aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/aggregation/hit.cpp
blob: cf6aa01c9c967c8fd35ac8cfead8575faea1dce0 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "hit.h"
#include <vespa/vespalib/objects/visit.h>

namespace search::aggregation {

using vespalib::Serializer;
using vespalib::Deserializer;

IMPLEMENT_IDENTIFIABLE_ABSTRACT_NS2(search, aggregation, Hit, vespalib::Identifiable);

namespace {
    const vespalib::string _G_rankField("rank");
}

Serializer &
Hit::onSerialize(Serializer &os) const
{
    return os.put(_rank);
}

Deserializer &
Hit::onDeserialize(Deserializer &is)
{
    return is.get(_rank);
}

int
Hit::onCmp(const Identifiable &b) const
{
    const Hit &h = (const Hit &)b;
    return (_rank > h._rank) ? -1 : ((_rank < h._rank) ? 1 : 0);
}

void
Hit::visitMembers(vespalib::ObjectVisitor &visitor) const
{
    visit(visitor, _G_rankField, _rank);
}

}

// this function was added by ../../forcelink.sh
void forcelink_file_searchlib_aggregation_hit() {}