Couchbase C++ SDK 1.0.2 (rev. 51f4775)
Loading...
Searching...
No Matches
search_row.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
23
24#include <memory>
25
26namespace couchbase
27{
28#ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
29class internal_search_row;
30#endif
31
39{
40public:
45 explicit search_row(internal_search_row internal);
46 search_row(search_row&& other) noexcept;
48 auto operator=(search_row&& other) noexcept -> search_row&;
49
54 [[nodiscard]] auto index() const -> const std::string&;
55
60 [[nodiscard]] auto id() const -> const std::string&;
61
66 [[nodiscard]] auto score() const -> double;
67
72 [[nodiscard]] auto fields() const -> const codec::binary&;
73
74 template<typename Serializer,
75 typename Document = typename Serializer::document_type,
76 std::enable_if_t<codec::is_serializer_v<Serializer>, bool> = true>
77 [[nodiscard]] auto fields_as() const -> Document
78 {
79 if (fields().empty()) {
80 return Document{};
81 }
82 return Serializer::template deserialize<Document>(fields());
83 }
84
89 [[nodiscard]] auto explanation() const -> const codec::binary&;
90
95 [[nodiscard]] auto locations() const -> const std::optional<search_row_locations>&;
96
101 [[nodiscard]] auto fragments() const -> const std::map<std::string, std::vector<std::string>>&;
102
103private:
104 std::unique_ptr<internal_search_row> internal_;
105};
106
107} // namespace couchbase
Definition search_row_locations.hxx:39
Search Metrics contains the search result metrics containing counts and timings.
Definition search_row.hxx:39
search_row(internal_search_row internal)
auto fields() const -> const codec::binary &
search_row(search_row &&other) noexcept
auto locations() const -> const std::optional< search_row_locations > &
auto fragments() const -> const std::map< std::string, std::vector< std::string > > &
auto fields_as() const -> Document
Definition search_row.hxx:77
auto explanation() const -> const codec::binary &
auto index() const -> const std::string &
auto operator=(search_row &&other) noexcept -> search_row &
auto score() const -> double
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28