aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/index/field_length_info.h
blob: 5f0a7bb2b51073facc3e4b5dc83103dae2e9e1c7 (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
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <cstdint>

namespace search::index {

/**
 * Information about average field length for a single index field.
 */
class FieldLengthInfo {
private:
    double   _average_field_length;
    uint32_t _num_samples;

public:
    FieldLengthInfo() noexcept
        : FieldLengthInfo(0.0, 0)
    {
    }

    FieldLengthInfo(double average_field_length, uint32_t num_samples) noexcept
        : _average_field_length(average_field_length),
          _num_samples(num_samples)
    {
    }

    [[nodiscard]] double get_average_field_length() const noexcept { return _average_field_length; }
    [[nodiscard]] uint32_t get_num_samples() const noexcept { return _num_samples; }
};

}