couchbase 4.2.3 → 4.2.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (199) hide show
  1. package/deps/couchbase-cxx-client/CMakeLists.txt +54 -4
  2. package/deps/couchbase-cxx-client/README.md +1 -0
  3. package/deps/couchbase-cxx-client/bin/create-search-index +164 -0
  4. package/deps/couchbase-cxx-client/bin/init-cluster +55 -10
  5. package/deps/couchbase-cxx-client/bin/run-unit-tests +62 -6
  6. package/deps/couchbase-cxx-client/bin/travel-sample-index-v6.json +184 -0
  7. package/deps/couchbase-cxx-client/bin/travel-sample-index.json +188 -0
  8. package/deps/couchbase-cxx-client/cmake/Documentation.cmake +0 -1
  9. package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +98 -3
  10. package/deps/couchbase-cxx-client/cmake/Testing.cmake +8 -0
  11. package/deps/couchbase-cxx-client/cmake/build_config.hxx.in +3 -0
  12. package/deps/couchbase-cxx-client/core/bucket.cxx +183 -152
  13. package/deps/couchbase-cxx-client/core/bucket.hxx +17 -4
  14. package/deps/couchbase-cxx-client/core/cluster.hxx +18 -1
  15. package/deps/couchbase-cxx-client/core/cluster_options.hxx +1 -0
  16. package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +2 -1
  17. package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +10 -12
  18. package/deps/couchbase-cxx-client/core/error_context/search.hxx +1 -1
  19. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
  20. package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +40 -0
  21. package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +62 -0
  22. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -0
  23. package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +51 -0
  24. package/deps/couchbase-cxx-client/core/impl/date_range.cxx +89 -0
  25. package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +54 -0
  26. package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +64 -0
  27. package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +125 -0
  28. package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +51 -0
  29. package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +29 -0
  30. package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +29 -0
  31. package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +29 -0
  32. package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +46 -0
  33. package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +43 -0
  34. package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +46 -0
  35. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +80 -0
  36. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +48 -0
  37. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +80 -0
  38. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +48 -0
  39. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +141 -0
  40. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +61 -0
  41. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +60 -0
  42. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +41 -0
  43. package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +84 -0
  44. package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +43 -0
  45. package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +82 -0
  46. package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +56 -0
  47. package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +32 -0
  48. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +137 -0
  49. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +45 -0
  50. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +80 -0
  51. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +48 -0
  52. package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +98 -0
  53. package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +35 -0
  54. package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +35 -0
  55. package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +43 -0
  56. package/deps/couchbase-cxx-client/core/impl/match_query.cxx +59 -0
  57. package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +49 -0
  58. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +54 -0
  59. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +64 -0
  60. package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +56 -0
  61. package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +42 -0
  62. package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +40 -0
  63. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +75 -0
  64. package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +37 -0
  65. package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +40 -0
  66. package/deps/couchbase-cxx-client/core/impl/search.cxx +191 -0
  67. package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +147 -0
  68. package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +46 -0
  69. package/deps/couchbase-cxx-client/core/impl/search_result.cxx +66 -0
  70. package/deps/couchbase-cxx-client/core/impl/search_row.cxx +74 -0
  71. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +64 -0
  72. package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +66 -0
  73. package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +104 -0
  74. package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +43 -0
  75. package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +43 -0
  76. package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +36 -0
  77. package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +64 -0
  78. package/deps/couchbase-cxx-client/core/impl/term_query.cxx +56 -0
  79. package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +57 -0
  80. package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +40 -0
  81. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +9 -2
  82. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +54 -37
  83. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +4 -3
  84. package/deps/couchbase-cxx-client/core/json_string.hxx +5 -0
  85. package/deps/couchbase-cxx-client/core/meta/version.cxx +18 -4
  86. package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +39 -0
  87. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +3 -1
  88. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -1
  89. package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +11 -2
  90. package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +1 -0
  91. package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +59 -46
  92. package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +1 -0
  93. package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +1 -1
  94. package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +77 -0
  95. package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +223 -0
  96. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +39 -0
  97. package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +88 -0
  98. package/deps/couchbase-cxx-client/couchbase/date_range.hxx +69 -0
  99. package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +56 -0
  100. package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +55 -0
  101. package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +265 -0
  102. package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +109 -0
  103. package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +111 -0
  104. package/deps/couchbase-cxx-client/couchbase/error_context.hxx +17 -8
  105. package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
  106. package/deps/couchbase-cxx-client/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
  107. package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +49 -0
  108. package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +107 -0
  109. package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +109 -0
  110. package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +32 -0
  111. package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +85 -0
  112. package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +45 -0
  113. package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +7 -2
  114. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +1 -1
  115. package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +43 -0
  116. package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +43 -0
  117. package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +45 -0
  118. package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +108 -0
  119. package/deps/couchbase-cxx-client/couchbase/match_query.hxx +163 -0
  120. package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +58 -0
  121. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +56 -0
  122. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +55 -0
  123. package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +143 -0
  124. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +93 -0
  125. package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +82 -0
  126. package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +3 -1
  127. package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +72 -0
  128. package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +82 -0
  129. package/deps/couchbase-cxx-client/couchbase/scope.hxx +39 -0
  130. package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +68 -0
  131. package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +138 -0
  132. package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +60 -0
  133. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +50 -0
  134. package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +85 -0
  135. package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +127 -0
  136. package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +69 -0
  137. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +509 -0
  138. package/deps/couchbase-cxx-client/couchbase/search_query.hxx +69 -0
  139. package/deps/couchbase-cxx-client/couchbase/search_result.hxx +77 -0
  140. package/deps/couchbase-cxx-client/couchbase/search_row.hxx +104 -0
  141. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +55 -0
  142. package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +86 -0
  143. package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +34 -0
  144. package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +58 -0
  145. package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +117 -0
  146. package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +26 -0
  147. package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +27 -0
  148. package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +28 -0
  149. package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +60 -0
  150. package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +60 -0
  151. package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +51 -0
  152. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +3 -0
  153. package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +4 -2
  154. package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +48 -0
  155. package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +55 -0
  156. package/deps/couchbase-cxx-client/couchbase/term_query.hxx +151 -0
  157. package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +142 -0
  158. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
  159. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +2 -1
  160. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +1 -1
  161. package/deps/couchbase-cxx-client/couchbase/transactions.hxx +3 -3
  162. package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +83 -0
  163. package/deps/couchbase-cxx-client/docs/Doxyfile.in +1 -1
  164. package/deps/couchbase-cxx-client/docs/cbc-analytics.md +2 -2
  165. package/deps/couchbase-cxx-client/docs/cbc-get.md +3 -2
  166. package/deps/couchbase-cxx-client/docs/cbc-pillowfight.md +7 -2
  167. package/deps/couchbase-cxx-client/docs/cbc-query.md +2 -2
  168. package/deps/couchbase-cxx-client/docs/cbc.md +3 -3
  169. package/deps/couchbase-cxx-client/docs/cli.hxx +5 -5
  170. package/deps/couchbase-cxx-client/docs/mainpage.hxx +42 -5
  171. package/deps/couchbase-cxx-client/test/CMakeLists.txt +1 -0
  172. package/deps/couchbase-cxx-client/test/test_integration_analytics.cxx +28 -6
  173. package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +7 -3
  174. package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +7 -3
  175. package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +13 -3
  176. package/deps/couchbase-cxx-client/test/test_integration_diagnostics.cxx +8 -2
  177. package/deps/couchbase-cxx-client/test/test_integration_durability.cxx +12 -7
  178. package/deps/couchbase-cxx-client/test/test_integration_examples.cxx +283 -11
  179. package/deps/couchbase-cxx-client/test/test_integration_management.cxx +140 -88
  180. package/deps/couchbase-cxx-client/test/test_integration_query.cxx +67 -9
  181. package/deps/couchbase-cxx-client/test/test_integration_range_scan.cxx +12 -12
  182. package/deps/couchbase-cxx-client/test/test_integration_read_replica.cxx +48 -11
  183. package/deps/couchbase-cxx-client/test/test_integration_search.cxx +19 -1
  184. package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +60 -9
  185. package/deps/couchbase-cxx-client/test/test_integration_tracer.cxx +3 -0
  186. package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +4 -0
  187. package/deps/couchbase-cxx-client/test/test_transaction_examples.cxx +100 -85
  188. package/deps/couchbase-cxx-client/test/test_unit_connection_string.cxx +29 -0
  189. package/deps/couchbase-cxx-client/test/test_unit_search.cxx +427 -0
  190. package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -1
  191. package/deps/couchbase-cxx-client/test/utils/logger.cxx +3 -1
  192. package/deps/couchbase-cxx-client/test/utils/server_version.hxx +31 -15
  193. package/deps/couchbase-cxx-client/test/utils/test_context.cxx +8 -0
  194. package/deps/couchbase-cxx-client/tools/get.cxx +9 -8
  195. package/deps/couchbase-cxx-client/tools/pillowfight.cxx +175 -75
  196. package/deps/couchbase-cxx-client/tools/version.cxx +4 -2
  197. package/dist/binding.d.ts +1 -1
  198. package/package.json +1 -1
  199. package/src/jstocbpp_autogen.hpp +3 -2
@@ -0,0 +1,138 @@
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 <couchbase/error_context.hxx>
21
+
22
+ #include <cstdint>
23
+ #include <memory>
24
+
25
+ namespace couchbase
26
+ {
27
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
28
+ class internal_search_error_context;
29
+ #endif
30
+
31
+ /**
32
+ * The error context returned with Search operations.
33
+ *
34
+ * @since 1.0.0
35
+ * @committed
36
+ */
37
+ class search_error_context : public error_context
38
+ {
39
+ public:
40
+ search_error_context();
41
+ explicit search_error_context(internal_search_error_context ctx);
42
+ search_error_context(search_error_context&& other);
43
+ search_error_context& operator=(search_error_context&& other);
44
+ search_error_context(const search_error_context& other) = delete;
45
+ search_error_context& operator=(const search_error_context& other) = delete;
46
+ ~search_error_context() override;
47
+
48
+ /**
49
+ * Returns status of the operation.
50
+ *
51
+ * @see couchbase::errc error codes that might be generated by the library
52
+ *
53
+ * @return error code or false-like value for success
54
+ *
55
+ * @since 1.0.0
56
+ * @committed
57
+ */
58
+ [[nodiscard]] auto ec() const -> std::error_code override;
59
+
60
+ /**
61
+ * The hostname/ip where this request got last dispatched to.
62
+ *
63
+ * @return address encoded as a string
64
+ *
65
+ * @since 1.0.0
66
+ * @committed
67
+ */
68
+ [[nodiscard]] auto last_dispatched_to() const -> const std::optional<std::string>& override;
69
+
70
+ /**
71
+ * The hostname/ip where this request got last dispatched from.
72
+ *
73
+ * @return address encoded as a string
74
+ *
75
+ * @since 1.0.0
76
+ * @committed
77
+ */
78
+ [[nodiscard]] auto last_dispatched_from() const -> const std::optional<std::string>& override;
79
+
80
+ /**
81
+ * The number of times the attached request has been retried.
82
+ *
83
+ * @return number of retries.
84
+ *
85
+ * @since 1.0.0
86
+ * @committed
87
+ */
88
+ [[nodiscard]] auto retry_attempts() const -> std::size_t override;
89
+
90
+ /**
91
+ * Set of reasons recorded during retrying the operation.
92
+ *
93
+ * @return set of reasons (empty if the operation was not retried)
94
+ *
95
+ * @since 1.0.0
96
+ * @committed
97
+ */
98
+ [[nodiscard]] auto retry_reasons() const -> const std::set<retry_reason>& override;
99
+
100
+ /**
101
+ * Check if the operation was retried because of given reason.
102
+ *
103
+ * @param reason reason to check
104
+ * @return true if the reason exists in set of recorded reasons.
105
+ *
106
+ * @since 1.0.0
107
+ * @uncommitted
108
+ */
109
+ [[nodiscard]] auto retried_because_of(retry_reason reason) const -> bool override;
110
+
111
+ [[nodiscard]] auto index_name() const -> const std::string&;
112
+
113
+ [[nodiscard]] auto client_context_id() const -> const std::string&;
114
+
115
+ [[nodiscard]] auto query() const -> const std::string&;
116
+
117
+ [[nodiscard]] auto parameters() const -> const std::optional<std::string>&;
118
+
119
+ [[nodiscard]] auto method() const -> const std::string&;
120
+
121
+ [[nodiscard]] auto path() const -> const std::string&;
122
+
123
+ [[nodiscard]] auto http_status() const -> std::uint32_t;
124
+
125
+ [[nodiscard]] auto http_body() const -> const std::string&;
126
+
127
+ [[nodiscard]] auto hostname() const -> const std::string&;
128
+
129
+ [[nodiscard]] auto port() const -> std::uint16_t;
130
+
131
+ [[nodiscard]] auto error() const -> const std::string&;
132
+
133
+ [[nodiscard]] auto status() const -> const std::string&;
134
+
135
+ private:
136
+ std::unique_ptr<internal_search_error_context> internal_;
137
+ };
138
+ } // namespace couchbase
@@ -0,0 +1,60 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2023-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 <cstdint>
21
+ #include <string>
22
+
23
+ namespace couchbase
24
+ {
25
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
26
+ struct encoded_search_facet;
27
+ #endif
28
+
29
+ /**
30
+ * Base class for full text facets of search queries.
31
+ */
32
+ class search_facet
33
+ {
34
+ public:
35
+ virtual ~search_facet() = default;
36
+
37
+ /**
38
+ * @return encoded representation of the search facet.
39
+ *
40
+ * @since 1.0.0
41
+ * @internal
42
+ */
43
+ [[nodiscard]] virtual auto encode() const -> encoded_search_facet = 0;
44
+
45
+ protected:
46
+ search_facet(std::string field, std::uint32_t size)
47
+ : field_{ std::move(field) }
48
+ , size_{ size }
49
+ {
50
+ }
51
+
52
+ search_facet(std::string field)
53
+ : field_{ std::move(field) }
54
+ {
55
+ }
56
+
57
+ std::string field_;
58
+ std::optional<std::uint32_t> size_{};
59
+ };
60
+ } // namespace couchbase
@@ -0,0 +1,50 @@
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 <couchbase/codec/tao_json_serializer.hxx>
21
+ #include <couchbase/search_meta_data.hxx>
22
+
23
+ #include "search_row.hxx"
24
+ #include <chrono>
25
+ #include <cinttypes>
26
+ #include <optional>
27
+ #include <vector>
28
+
29
+ namespace couchbase
30
+ {
31
+ /**
32
+ * @since 1.0.0
33
+ * @committed
34
+ */
35
+ class search_facet_result
36
+ {
37
+ public:
38
+ virtual ~search_facet_result() = default;
39
+
40
+ /**
41
+ * @since 1.0.0
42
+ * @internal
43
+ */
44
+ [[nodiscard]] virtual auto name() const -> const std::string& = 0;
45
+ [[nodiscard]] virtual auto field() const -> const std::string& = 0;
46
+ [[nodiscard]] virtual auto total() const -> std::uint64_t = 0;
47
+ [[nodiscard]] virtual auto missing() const -> std::uint64_t = 0;
48
+ [[nodiscard]] virtual auto other() const -> std::uint64_t = 0;
49
+ };
50
+ } // namespace couchbase
@@ -0,0 +1,85 @@
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 <couchbase/codec/json_transcoder.hxx>
21
+ #include <couchbase/search_metrics.hxx>
22
+
23
+ #include <cinttypes>
24
+ #include <map>
25
+ #include <memory>
26
+ #include <optional>
27
+ #include <vector>
28
+
29
+ namespace couchbase
30
+ {
31
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
32
+ class internal_search_meta_data;
33
+ #endif
34
+
35
+ /**
36
+ * Stores any non-rows results related to the execution of a particular N1QL search.
37
+ *
38
+ * @since 1.0.0
39
+ * @committed
40
+ */
41
+ class search_meta_data
42
+ {
43
+ public:
44
+ /**
45
+ * @since 1.0.0
46
+ * @volatile
47
+ */
48
+ explicit search_meta_data(internal_search_meta_data internal);
49
+
50
+ /**
51
+ * Returns the client context identifier string set on the search request.
52
+ *
53
+ * @return client context identifier
54
+ *
55
+ * @since 1.0.0
56
+ * @committed
57
+ */
58
+ [[nodiscard]] auto client_context_id() const -> const std::string&;
59
+ /**
60
+ * Returns any warnings returned by the search engine.
61
+ *
62
+ * It returns an empty vector if no warnings were returned.
63
+ *
64
+ * @return vector of the reported warnings.
65
+ *
66
+ * @since 1.0.0
67
+ * @committed
68
+ */
69
+ [[nodiscard]] auto errors() const -> const std::map<std::string, std::string>&;
70
+
71
+ /**
72
+ * Returns the {@link search_metrics} as returned by the search engine if enabled.
73
+ *
74
+ * @return metrics
75
+ *
76
+ * @since 1.0.0
77
+ * @committed
78
+ */
79
+ [[nodiscard]] auto metrics() const -> const search_metrics&;
80
+
81
+ private:
82
+ std::unique_ptr<internal_search_meta_data> internal_;
83
+ };
84
+
85
+ } // namespace couchbase
@@ -0,0 +1,127 @@
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
+
23
+ namespace couchbase
24
+ {
25
+
26
+ /**
27
+ * Search Metrics contains the search result metrics containing counts and timings
28
+ *
29
+ * @since 1.0.0
30
+ * @committed
31
+ */
32
+ class search_metrics
33
+ {
34
+ public:
35
+ /**
36
+ * @since 1.0.0
37
+ * @internal
38
+ */
39
+ search_metrics() = default;
40
+
41
+ /**
42
+ * @since 1.0.0
43
+ * @volatile
44
+ */
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
+
60
+ /**
61
+ * The total time taken for the request, that is the time from when the request was received until the results were returned.
62
+ *
63
+ * @return total time duration
64
+ *
65
+ * @since 1.0.0
66
+ * @committed
67
+ */
68
+ [[nodiscard]] auto took() const -> std::chrono::nanoseconds
69
+ {
70
+ return took_;
71
+ }
72
+
73
+ /**
74
+ * @since 1.0.0
75
+ * @committed
76
+ */
77
+ [[nodiscard]] auto total_rows() const -> std::uint64_t
78
+ {
79
+ return total_rows_;
80
+ }
81
+
82
+ /**
83
+ * @since 1.0.0
84
+ * @committed
85
+ */
86
+ [[nodiscard]] auto success_partition_count() const -> std::uint64_t
87
+ {
88
+ return success_partition_count_;
89
+ }
90
+
91
+ /**
92
+ * @since 1.0.0
93
+ * @committed
94
+ */
95
+ [[nodiscard]] auto error_partition_count() const -> std::uint64_t
96
+ {
97
+ return error_partition_count_;
98
+ }
99
+
100
+ /**
101
+ * @since 1.0.0
102
+ * @committed
103
+ */
104
+ [[nodiscard]] auto total_partition_count() const -> std::uint64_t
105
+ {
106
+ return total_partition_count_;
107
+ }
108
+
109
+ /**
110
+ * @since 1.0.0
111
+ * @committed
112
+ */
113
+ [[nodiscard]] auto max_score() const -> double
114
+ {
115
+ return max_score_;
116
+ }
117
+
118
+ private:
119
+ std::chrono::nanoseconds took_{};
120
+ std::uint64_t total_rows_{};
121
+ std::uint64_t success_partition_count_{};
122
+ std::uint64_t error_partition_count_{};
123
+ std::uint64_t total_partition_count_{};
124
+ double max_score_{};
125
+ };
126
+
127
+ } // namespace couchbase
@@ -0,0 +1,69 @@
1
+ /* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
+ /*
3
+ * Copyright 2023-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 <cinttypes>
21
+ #include <string>
22
+
23
+ namespace couchbase
24
+ {
25
+ /**
26
+ * @since 1.0.0
27
+ * @committed
28
+ */
29
+ class search_numeric_range
30
+ {
31
+ public:
32
+ search_numeric_range(std::string name,
33
+ std::variant<std::monostate, std::uint64_t, double> min,
34
+ std::variant<std::monostate, std::uint64_t, double> max,
35
+ std::uint64_t count)
36
+ : name_{ std::move(name) }
37
+ , min_{ min }
38
+ , max_{ max }
39
+ , count_{ count }
40
+ {
41
+ }
42
+
43
+ [[nodiscard]] auto name() const -> const std::string&
44
+ {
45
+ return name_;
46
+ }
47
+
48
+ [[nodiscard]] auto min() const -> const std::variant<std::monostate, std::uint64_t, double>&
49
+ {
50
+ return min_;
51
+ }
52
+
53
+ [[nodiscard]] auto max() const -> const std::variant<std::monostate, std::uint64_t, double>&
54
+ {
55
+ return max_;
56
+ }
57
+
58
+ [[nodiscard]] auto count() const -> std::uint64_t
59
+ {
60
+ return count_;
61
+ }
62
+
63
+ private:
64
+ std::string name_;
65
+ std::variant<std::monostate, std::uint64_t, double> min_{};
66
+ std::variant<std::monostate, std::uint64_t, double> max_{};
67
+ std::uint64_t count_;
68
+ };
69
+ } // namespace couchbase