Couchbase C++ SDK 1.0.2 (rev. 51f4775)
Loading...
Searching...
No Matches
search_metrics.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2/*
3 * Copyright 2020-Present Couchbase, Inc.
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#pragma once
19
20#include <chrono>
21#include <cinttypes>
22
23namespace couchbase
24{
25
33{
34public:
39 search_metrics() = default;
40
45 search_metrics(std::chrono::nanoseconds took,
46 std::uint64_t total_rows,
47 std::uint64_t success_partition_count,
48 std::uint64_t error_partition_count,
49 std::uint64_t total_partition_count,
50 double max_score)
51 : took_{ took }
52 , total_rows_{ total_rows }
53 , success_partition_count_{ success_partition_count }
54 , error_partition_count_{ error_partition_count }
55 , total_partition_count_{ total_partition_count }
56 , max_score_{ max_score }
57 {
58 }
59
69 [[nodiscard]] auto took() const -> std::chrono::nanoseconds
70 {
71 return took_;
72 }
73
78 [[nodiscard]] auto total_rows() const -> std::uint64_t
79 {
80 return total_rows_;
81 }
82
87 [[nodiscard]] auto success_partition_count() const -> std::uint64_t
88 {
89 return success_partition_count_;
90 }
91
96 [[nodiscard]] auto error_partition_count() const -> std::uint64_t
97 {
98 return error_partition_count_;
99 }
100
105 [[nodiscard]] auto total_partition_count() const -> std::uint64_t
106 {
107 return total_partition_count_;
108 }
109
114 [[nodiscard]] auto max_score() const -> double
115 {
116 return max_score_;
117 }
118
119private:
120 std::chrono::nanoseconds took_{};
121 std::uint64_t total_rows_{};
122 std::uint64_t success_partition_count_{};
123 std::uint64_t error_partition_count_{};
124 std::uint64_t total_partition_count_{};
125 double max_score_{};
126};
127
128} // namespace couchbase
Search Metrics contains the search result metrics containing counts and timings.
Definition search_metrics.hxx:33
search_metrics(std::chrono::nanoseconds took, std::uint64_t total_rows, std::uint64_t success_partition_count, std::uint64_t error_partition_count, std::uint64_t total_partition_count, double max_score)
Definition search_metrics.hxx:45
auto success_partition_count() const -> std::uint64_t
Definition search_metrics.hxx:87
auto total_rows() const -> std::uint64_t
Definition search_metrics.hxx:78
auto took() const -> std::chrono::nanoseconds
The total time taken for the request, that is the time from when the request was received until the r...
Definition search_metrics.hxx:69
auto max_score() const -> double
Definition search_metrics.hxx:114
auto error_partition_count() const -> std::uint64_t
Definition search_metrics.hxx:96
auto total_partition_count() const -> std::uint64_t
Definition search_metrics.hxx:105
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28