couchbase 4.2.3 → 4.2.5-dev.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (205) hide show
  1. package/CMakeLists.txt +136 -11
  2. package/deps/couchbase-cxx-client/CMakeLists.txt +54 -4
  3. package/deps/couchbase-cxx-client/README.md +1 -0
  4. package/deps/couchbase-cxx-client/bin/create-search-index +164 -0
  5. package/deps/couchbase-cxx-client/bin/init-cluster +55 -10
  6. package/deps/couchbase-cxx-client/bin/run-unit-tests +62 -6
  7. package/deps/couchbase-cxx-client/bin/travel-sample-index-v6.json +184 -0
  8. package/deps/couchbase-cxx-client/bin/travel-sample-index.json +188 -0
  9. package/deps/couchbase-cxx-client/cmake/Documentation.cmake +0 -1
  10. package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +98 -3
  11. package/deps/couchbase-cxx-client/cmake/Testing.cmake +8 -0
  12. package/deps/couchbase-cxx-client/cmake/build_config.hxx.in +3 -0
  13. package/deps/couchbase-cxx-client/core/bucket.cxx +183 -152
  14. package/deps/couchbase-cxx-client/core/bucket.hxx +17 -4
  15. package/deps/couchbase-cxx-client/core/cluster.hxx +18 -1
  16. package/deps/couchbase-cxx-client/core/cluster_options.hxx +1 -0
  17. package/deps/couchbase-cxx-client/core/error_context/key_value.cxx +2 -1
  18. package/deps/couchbase-cxx-client/core/error_context/key_value.hxx +10 -12
  19. package/deps/couchbase-cxx-client/core/error_context/search.hxx +1 -1
  20. package/deps/couchbase-cxx-client/core/impl/analytics.cxx +1 -0
  21. package/deps/couchbase-cxx-client/core/impl/boolean_field_query.cxx +40 -0
  22. package/deps/couchbase-cxx-client/core/impl/boolean_query.cxx +62 -0
  23. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +1 -0
  24. package/deps/couchbase-cxx-client/core/impl/conjunction_query.cxx +51 -0
  25. package/deps/couchbase-cxx-client/core/impl/date_range.cxx +89 -0
  26. package/deps/couchbase-cxx-client/core/impl/date_range_facet.cxx +54 -0
  27. package/deps/couchbase-cxx-client/core/impl/date_range_facet_result.cxx +64 -0
  28. package/deps/couchbase-cxx-client/core/impl/date_range_query.cxx +125 -0
  29. package/deps/couchbase-cxx-client/core/impl/disjunction_query.cxx +51 -0
  30. package/deps/couchbase-cxx-client/core/impl/encoded_search_facet.hxx +29 -0
  31. package/deps/couchbase-cxx-client/core/impl/encoded_search_query.hxx +29 -0
  32. package/deps/couchbase-cxx-client/core/impl/encoded_search_sort.hxx +29 -0
  33. package/deps/couchbase-cxx-client/core/impl/geo_bounding_box_query.cxx +46 -0
  34. package/deps/couchbase-cxx-client/core/impl/geo_distance_query.cxx +43 -0
  35. package/deps/couchbase-cxx-client/core/impl/geo_polygon_query.cxx +46 -0
  36. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.cxx +80 -0
  37. package/deps/couchbase-cxx-client/core/impl/internal_date_range_facet_result.hxx +48 -0
  38. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.cxx +80 -0
  39. package/deps/couchbase-cxx-client/core/impl/internal_numeric_range_facet_result.hxx +48 -0
  40. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.cxx +141 -0
  41. package/deps/couchbase-cxx-client/core/impl/internal_search_error_context.hxx +61 -0
  42. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.cxx +60 -0
  43. package/deps/couchbase-cxx-client/core/impl/internal_search_meta_data.hxx +41 -0
  44. package/deps/couchbase-cxx-client/core/impl/internal_search_result.cxx +84 -0
  45. package/deps/couchbase-cxx-client/core/impl/internal_search_result.hxx +43 -0
  46. package/deps/couchbase-cxx-client/core/impl/internal_search_row.cxx +82 -0
  47. package/deps/couchbase-cxx-client/core/impl/internal_search_row.hxx +56 -0
  48. package/deps/couchbase-cxx-client/core/impl/internal_search_row_location.hxx +32 -0
  49. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.cxx +137 -0
  50. package/deps/couchbase-cxx-client/core/impl/internal_search_row_locations.hxx +45 -0
  51. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.cxx +80 -0
  52. package/deps/couchbase-cxx-client/core/impl/internal_term_facet_result.hxx +48 -0
  53. package/deps/couchbase-cxx-client/core/impl/key_value_error_context.cxx +98 -0
  54. package/deps/couchbase-cxx-client/core/impl/match_all_query.cxx +35 -0
  55. package/deps/couchbase-cxx-client/core/impl/match_none_query.cxx +35 -0
  56. package/deps/couchbase-cxx-client/core/impl/match_phrase_query.cxx +43 -0
  57. package/deps/couchbase-cxx-client/core/impl/match_query.cxx +59 -0
  58. package/deps/couchbase-cxx-client/core/impl/numeric_range.cxx +49 -0
  59. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet.cxx +54 -0
  60. package/deps/couchbase-cxx-client/core/impl/numeric_range_facet_result.cxx +64 -0
  61. package/deps/couchbase-cxx-client/core/impl/numeric_range_query.cxx +56 -0
  62. package/deps/couchbase-cxx-client/core/impl/phrase_query.cxx +42 -0
  63. package/deps/couchbase-cxx-client/core/impl/prefix_query.cxx +40 -0
  64. package/deps/couchbase-cxx-client/core/impl/query_error_context.cxx +75 -0
  65. package/deps/couchbase-cxx-client/core/impl/query_string_query.cxx +37 -0
  66. package/deps/couchbase-cxx-client/core/impl/regexp_query.cxx +40 -0
  67. package/deps/couchbase-cxx-client/core/impl/search.cxx +191 -0
  68. package/deps/couchbase-cxx-client/core/impl/search_error_context.cxx +147 -0
  69. package/deps/couchbase-cxx-client/core/impl/search_meta_data.cxx +46 -0
  70. package/deps/couchbase-cxx-client/core/impl/search_result.cxx +66 -0
  71. package/deps/couchbase-cxx-client/core/impl/search_row.cxx +74 -0
  72. package/deps/couchbase-cxx-client/core/impl/search_row_location.cxx +64 -0
  73. package/deps/couchbase-cxx-client/core/impl/search_row_locations.cxx +66 -0
  74. package/deps/couchbase-cxx-client/core/impl/search_sort_field.cxx +104 -0
  75. package/deps/couchbase-cxx-client/core/impl/search_sort_id.cxx +43 -0
  76. package/deps/couchbase-cxx-client/core/impl/search_sort_score.cxx +43 -0
  77. package/deps/couchbase-cxx-client/core/impl/term_facet.cxx +36 -0
  78. package/deps/couchbase-cxx-client/core/impl/term_facet_result.cxx +64 -0
  79. package/deps/couchbase-cxx-client/core/impl/term_query.cxx +56 -0
  80. package/deps/couchbase-cxx-client/core/impl/term_range_query.cxx +57 -0
  81. package/deps/couchbase-cxx-client/core/impl/wildcard_query.cxx +40 -0
  82. package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +9 -2
  83. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +54 -37
  84. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +4 -3
  85. package/deps/couchbase-cxx-client/core/json_string.hxx +5 -0
  86. package/deps/couchbase-cxx-client/core/meta/version.cxx +18 -4
  87. package/deps/couchbase-cxx-client/core/mozilla_ca_bundle.hxx +39 -0
  88. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +3 -1
  89. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +1 -1
  90. package/deps/couchbase-cxx-client/core/protocol/client_request.hxx +11 -2
  91. package/deps/couchbase-cxx-client/core/protocol/client_response.hxx +1 -0
  92. package/deps/couchbase-cxx-client/core/utils/connection_string.cxx +59 -46
  93. package/deps/couchbase-cxx-client/core/utils/connection_string.hxx +1 -0
  94. package/deps/couchbase-cxx-client/couchbase/analytics_error_context.hxx +1 -1
  95. package/deps/couchbase-cxx-client/couchbase/boolean_field_query.hxx +77 -0
  96. package/deps/couchbase-cxx-client/couchbase/boolean_query.hxx +223 -0
  97. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +39 -0
  98. package/deps/couchbase-cxx-client/couchbase/conjunction_query.hxx +88 -0
  99. package/deps/couchbase-cxx-client/couchbase/date_range.hxx +69 -0
  100. package/deps/couchbase-cxx-client/couchbase/date_range_facet.hxx +56 -0
  101. package/deps/couchbase-cxx-client/couchbase/date_range_facet_result.hxx +55 -0
  102. package/deps/couchbase-cxx-client/couchbase/date_range_query.hxx +265 -0
  103. package/deps/couchbase-cxx-client/couchbase/disjunction_query.hxx +109 -0
  104. package/deps/couchbase-cxx-client/couchbase/doc_id_query.hxx +111 -0
  105. package/deps/couchbase-cxx-client/couchbase/error_context.hxx +17 -8
  106. package/deps/couchbase-cxx-client/couchbase/fmt/analytics_scan_consistency.hxx +52 -0
  107. package/deps/couchbase-cxx-client/{core/topology/error_map_fmt.hxx → couchbase/fmt/key_value_error_map_attribute.hxx} +21 -21
  108. package/deps/couchbase-cxx-client/couchbase/fmt/search_scan_consistency.hxx +49 -0
  109. package/deps/couchbase-cxx-client/couchbase/geo_bounding_box_query.hxx +107 -0
  110. package/deps/couchbase-cxx-client/couchbase/geo_distance_query.hxx +109 -0
  111. package/deps/couchbase-cxx-client/couchbase/geo_point.hxx +32 -0
  112. package/deps/couchbase-cxx-client/couchbase/geo_polygon_query.hxx +85 -0
  113. package/deps/couchbase-cxx-client/couchbase/highlight_style.hxx +45 -0
  114. package/deps/couchbase-cxx-client/couchbase/key_value_error_context.hxx +7 -2
  115. package/deps/couchbase-cxx-client/couchbase/manager_error_context.hxx +1 -1
  116. package/deps/couchbase-cxx-client/couchbase/match_all_query.hxx +43 -0
  117. package/deps/couchbase-cxx-client/couchbase/match_none_query.hxx +43 -0
  118. package/deps/couchbase-cxx-client/couchbase/match_operator.hxx +45 -0
  119. package/deps/couchbase-cxx-client/couchbase/match_phrase_query.hxx +108 -0
  120. package/deps/couchbase-cxx-client/couchbase/match_query.hxx +163 -0
  121. package/deps/couchbase-cxx-client/couchbase/numeric_range.hxx +58 -0
  122. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet.hxx +56 -0
  123. package/deps/couchbase-cxx-client/couchbase/numeric_range_facet_result.hxx +55 -0
  124. package/deps/couchbase-cxx-client/couchbase/numeric_range_query.hxx +143 -0
  125. package/deps/couchbase-cxx-client/couchbase/phrase_query.hxx +93 -0
  126. package/deps/couchbase-cxx-client/couchbase/prefix_query.hxx +82 -0
  127. package/deps/couchbase-cxx-client/couchbase/query_error_context.hxx +3 -1
  128. package/deps/couchbase-cxx-client/couchbase/query_string_query.hxx +72 -0
  129. package/deps/couchbase-cxx-client/couchbase/regexp_query.hxx +82 -0
  130. package/deps/couchbase-cxx-client/couchbase/scope.hxx +39 -0
  131. package/deps/couchbase-cxx-client/couchbase/search_date_range.hxx +68 -0
  132. package/deps/couchbase-cxx-client/couchbase/search_error_context.hxx +138 -0
  133. package/deps/couchbase-cxx-client/couchbase/search_facet.hxx +60 -0
  134. package/deps/couchbase-cxx-client/couchbase/search_facet_result.hxx +50 -0
  135. package/deps/couchbase-cxx-client/couchbase/search_meta_data.hxx +85 -0
  136. package/deps/couchbase-cxx-client/couchbase/search_metrics.hxx +127 -0
  137. package/deps/couchbase-cxx-client/couchbase/search_numeric_range.hxx +69 -0
  138. package/deps/couchbase-cxx-client/couchbase/search_options.hxx +509 -0
  139. package/deps/couchbase-cxx-client/couchbase/search_query.hxx +69 -0
  140. package/deps/couchbase-cxx-client/couchbase/search_result.hxx +77 -0
  141. package/deps/couchbase-cxx-client/couchbase/search_row.hxx +104 -0
  142. package/deps/couchbase-cxx-client/couchbase/search_row_location.hxx +55 -0
  143. package/deps/couchbase-cxx-client/couchbase/search_row_locations.hxx +86 -0
  144. package/deps/couchbase-cxx-client/couchbase/search_scan_consistency.hxx +34 -0
  145. package/deps/couchbase-cxx-client/couchbase/search_sort.hxx +58 -0
  146. package/deps/couchbase-cxx-client/couchbase/search_sort_field.hxx +117 -0
  147. package/deps/couchbase-cxx-client/couchbase/search_sort_field_missing.hxx +26 -0
  148. package/deps/couchbase-cxx-client/couchbase/search_sort_field_mode.hxx +27 -0
  149. package/deps/couchbase-cxx-client/couchbase/search_sort_field_type.hxx +28 -0
  150. package/deps/couchbase-cxx-client/couchbase/search_sort_id.hxx +60 -0
  151. package/deps/couchbase-cxx-client/couchbase/search_sort_score.hxx +60 -0
  152. package/deps/couchbase-cxx-client/couchbase/search_term_range.hxx +51 -0
  153. package/deps/couchbase-cxx-client/couchbase/security_options.hxx +3 -0
  154. package/deps/couchbase-cxx-client/couchbase/subdocument_error_context.hxx +4 -2
  155. package/deps/couchbase-cxx-client/couchbase/term_facet.hxx +48 -0
  156. package/deps/couchbase-cxx-client/couchbase/term_facet_result.hxx +55 -0
  157. package/deps/couchbase-cxx-client/couchbase/term_query.hxx +151 -0
  158. package/deps/couchbase-cxx-client/couchbase/term_range_query.hxx +142 -0
  159. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_options.hxx +1 -1
  160. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_query_options.hxx +2 -1
  161. package/deps/couchbase-cxx-client/couchbase/transactions/transaction_result.hxx +1 -1
  162. package/deps/couchbase-cxx-client/couchbase/transactions.hxx +3 -3
  163. package/deps/couchbase-cxx-client/couchbase/wildcard_query.hxx +83 -0
  164. package/deps/couchbase-cxx-client/docs/Doxyfile.in +1 -1
  165. package/deps/couchbase-cxx-client/docs/cbc-analytics.md +2 -2
  166. package/deps/couchbase-cxx-client/docs/cbc-get.md +3 -2
  167. package/deps/couchbase-cxx-client/docs/cbc-pillowfight.md +7 -2
  168. package/deps/couchbase-cxx-client/docs/cbc-query.md +2 -2
  169. package/deps/couchbase-cxx-client/docs/cbc.md +3 -3
  170. package/deps/couchbase-cxx-client/docs/cli.hxx +5 -5
  171. package/deps/couchbase-cxx-client/docs/mainpage.hxx +42 -5
  172. package/deps/couchbase-cxx-client/test/CMakeLists.txt +1 -0
  173. package/deps/couchbase-cxx-client/test/test_integration_analytics.cxx +28 -6
  174. package/deps/couchbase-cxx-client/test/test_integration_collections.cxx +7 -3
  175. package/deps/couchbase-cxx-client/test/test_integration_connect.cxx +7 -3
  176. package/deps/couchbase-cxx-client/test/test_integration_crud.cxx +13 -3
  177. package/deps/couchbase-cxx-client/test/test_integration_diagnostics.cxx +8 -2
  178. package/deps/couchbase-cxx-client/test/test_integration_durability.cxx +12 -7
  179. package/deps/couchbase-cxx-client/test/test_integration_examples.cxx +283 -11
  180. package/deps/couchbase-cxx-client/test/test_integration_management.cxx +140 -88
  181. package/deps/couchbase-cxx-client/test/test_integration_query.cxx +67 -9
  182. package/deps/couchbase-cxx-client/test/test_integration_range_scan.cxx +12 -12
  183. package/deps/couchbase-cxx-client/test/test_integration_read_replica.cxx +48 -11
  184. package/deps/couchbase-cxx-client/test/test_integration_search.cxx +19 -1
  185. package/deps/couchbase-cxx-client/test/test_integration_subdoc.cxx +60 -9
  186. package/deps/couchbase-cxx-client/test/test_integration_tracer.cxx +3 -0
  187. package/deps/couchbase-cxx-client/test/test_integration_transcoders.cxx +4 -0
  188. package/deps/couchbase-cxx-client/test/test_transaction_examples.cxx +100 -85
  189. package/deps/couchbase-cxx-client/test/test_unit_connection_string.cxx +29 -0
  190. package/deps/couchbase-cxx-client/test/test_unit_search.cxx +427 -0
  191. package/deps/couchbase-cxx-client/test/utils/integration_test_guard.cxx +2 -1
  192. package/deps/couchbase-cxx-client/test/utils/logger.cxx +3 -1
  193. package/deps/couchbase-cxx-client/test/utils/server_version.hxx +31 -15
  194. package/deps/couchbase-cxx-client/test/utils/test_context.cxx +8 -0
  195. package/deps/couchbase-cxx-client/tools/get.cxx +9 -8
  196. package/deps/couchbase-cxx-client/tools/pillowfight.cxx +175 -75
  197. package/deps/couchbase-cxx-client/tools/version.cxx +4 -2
  198. package/dist/binding.d.ts +1 -1
  199. package/dist/binding.js +3 -2
  200. package/package.json +96 -1
  201. package/scripts/createPlatformPackages.js +108 -0
  202. package/scripts/install.js +45 -0
  203. package/scripts/prebuilds.js +249 -0
  204. package/scripts/prune.js +124 -0
  205. package/src/jstocbpp_autogen.hpp +3 -2
@@ -182,33 +182,39 @@ struct action<bucket_name> {
182
182
  } // namespace priv
183
183
 
184
184
  void
185
- parse_option(std::string& receiver, const std::string& /* name */, const std::string& value)
185
+ parse_option(std::string& receiver, const std::string& /* name */, const std::string& value, std::vector<std::string>& /* warnings */)
186
186
  {
187
187
  receiver = string_codec::url_decode(value);
188
188
  }
189
189
 
190
190
  void
191
- parse_option(bool& receiver, const std::string& /* name */, const std::string& value)
191
+ parse_option(bool& receiver, const std::string& name, const std::string& value, std::vector<std::string>& warnings)
192
192
  {
193
193
  if (value == "true" || value == "yes" || value == "on") {
194
194
  receiver = true;
195
195
  } else if (value == "false" || value == "no" || value == "off") {
196
196
  receiver = false;
197
+ } else {
198
+ warnings.push_back(fmt::format(
199
+ R"(unable to parse "{}" parameter in connection string (value "{}" cannot be interpreted as a boolean))", name, value));
197
200
  }
198
201
  }
199
202
 
200
203
  void
201
- parse_option(tls_verify_mode& receiver, const std::string& /* name */, const std::string& value)
204
+ parse_option(tls_verify_mode& receiver, const std::string& name, const std::string& value, std::vector<std::string>& warnings)
202
205
  {
203
206
  if (value == "none") {
204
207
  receiver = tls_verify_mode::none;
205
208
  } else if (value == "peer") {
206
209
  receiver = tls_verify_mode::peer;
210
+ } else {
211
+ warnings.push_back(fmt::format(
212
+ R"(unable to parse "{}" parameter in connection string (value "{}" is not a valid TLS verification mode))", name, value));
207
213
  }
208
214
  }
209
215
 
210
216
  void
211
- parse_option(io::ip_protocol& receiver, const std::string& /* name */, const std::string& value)
217
+ parse_option(io::ip_protocol& receiver, const std::string& name, const std::string& value, std::vector<std::string>& warnings)
212
218
  {
213
219
  if (value == "any") {
214
220
  receiver = io::ip_protocol::any;
@@ -216,23 +222,28 @@ parse_option(io::ip_protocol& receiver, const std::string& /* name */, const std
216
222
  receiver = io::ip_protocol::force_ipv4;
217
223
  } else if (value == "force_ipv6") {
218
224
  receiver = io::ip_protocol::force_ipv6;
225
+ } else {
226
+ warnings.push_back(fmt::format(
227
+ R"(unable to parse "{}" parameter in connection string (value "{}" is not a valid IP protocol preference))", name, value));
219
228
  }
220
229
  }
221
230
 
222
231
  void
223
- parse_option(std::size_t& receiver, const std::string& name, const std::string& value)
232
+ parse_option(std::size_t& receiver, const std::string& name, const std::string& value, std::vector<std::string>& warnings)
224
233
  {
225
234
  try {
226
235
  receiver = std::stoull(value, nullptr, 10);
227
236
  } catch (const std::invalid_argument& ex1) {
228
- CB_LOG_WARNING(R"(unable to parse "{}" parameter in connection string (value "{}" is not a number): {})", name, value, ex1.what());
237
+ warnings.push_back(
238
+ fmt::format(R"(unable to parse "{}" parameter in connection string (value "{}" is not a number): {})", name, value, ex1.what()));
229
239
  } catch (const std::out_of_range& ex2) {
230
- CB_LOG_WARNING(R"(unable to parse "{}" parameter in connection string (value "{}" is out of range): {})", name, value, ex2.what());
240
+ warnings.push_back(
241
+ fmt::format(R"(unable to parse "{}" parameter in connection string (value "{}" is out of range): {})", name, value, ex2.what()));
231
242
  }
232
243
  }
233
244
 
234
245
  void
235
- parse_option(std::chrono::milliseconds& receiver, const std::string& name, const std::string& value)
246
+ parse_option(std::chrono::milliseconds& receiver, const std::string& name, const std::string& value, std::vector<std::string>& warnings)
236
247
  {
237
248
  try {
238
249
  receiver = std::chrono::duration_cast<std::chrono::milliseconds>(parse_duration(value));
@@ -240,11 +251,11 @@ parse_option(std::chrono::milliseconds& receiver, const std::string& name, const
240
251
  try {
241
252
  receiver = std::chrono::milliseconds(std::stoull(value, nullptr, 10));
242
253
  } catch (const std::invalid_argument& ex1) {
243
- CB_LOG_WARNING(
244
- R"(unable to parse "{}" parameter in connection string (value "{}" is not a number): {})", name, value, ex1.what());
254
+ warnings.push_back(fmt::format(
255
+ R"(unable to parse "{}" parameter in connection string (value "{}" is not a number): {})", name, value, ex1.what()));
245
256
  } catch (const std::out_of_range& ex2) {
246
- CB_LOG_WARNING(
247
- R"(unable to parse "{}" parameter in connection string (value "{}" is out of range): {})", name, value, ex2.what());
257
+ warnings.push_back(fmt::format(
258
+ R"(unable to parse "{}" parameter in connection string (value "{}" is out of range): {})", name, value, ex2.what()));
248
259
  }
249
260
  }
250
261
  }
@@ -262,68 +273,68 @@ extract_options(connection_string& connstr)
262
273
  * Number of seconds the client should wait while attempting to connect to a node’s KV service via a socket. Initial
263
274
  * connection, reconnecting, node added, etc.
264
275
  */
265
- parse_option(connstr.options.connect_timeout, name, value);
276
+ parse_option(connstr.options.connect_timeout, name, value, connstr.warnings);
266
277
  } else if (name == "kv_timeout" || name == "key_value_timeout") {
267
278
  /**
268
279
  * Number of milliseconds to wait before timing out a KV operation by the client.
269
280
  */
270
- parse_option(connstr.options.key_value_timeout, name, value);
281
+ parse_option(connstr.options.key_value_timeout, name, value, connstr.warnings);
271
282
  } else if (name == "kv_durable_timeout" || name == "key_value_durable_timeout") {
272
283
  /**
273
284
  * Number of milliseconds to wait before timing out a KV operation that is either using synchronous durability or
274
285
  * observe-based durability.
275
286
  */
276
- parse_option(connstr.options.key_value_durable_timeout, name, value);
287
+ parse_option(connstr.options.key_value_durable_timeout, name, value, connstr.warnings);
277
288
  } else if (name == "view_timeout") {
278
289
  /**
279
290
  * Number of seconds to wait before timing out a View request by the client..
280
291
  */
281
- parse_option(connstr.options.view_timeout, name, value);
292
+ parse_option(connstr.options.view_timeout, name, value, connstr.warnings);
282
293
  } else if (name == "query_timeout") {
283
294
  /**
284
295
  * Number of seconds to wait before timing out a Query or N1QL request by the client.
285
296
  */
286
- parse_option(connstr.options.query_timeout, name, value);
297
+ parse_option(connstr.options.query_timeout, name, value, connstr.warnings);
287
298
  } else if (name == "analytics_timeout") {
288
299
  /**
289
300
  * Number of seconds to wait before timing out an Analytics request by the client.
290
301
  */
291
- parse_option(connstr.options.analytics_timeout, name, value);
302
+ parse_option(connstr.options.analytics_timeout, name, value, connstr.warnings);
292
303
  } else if (name == "search_timeout") {
293
304
  /**
294
305
  * Number of seconds to wait before timing out a Search request by the client.
295
306
  */
296
- parse_option(connstr.options.search_timeout, name, value);
307
+ parse_option(connstr.options.search_timeout, name, value, connstr.warnings);
297
308
  } else if (name == "management_timeout") {
298
309
  /**
299
310
  * Number of seconds to wait before timing out a Management API request by the client.
300
311
  */
301
- parse_option(connstr.options.management_timeout, name, value);
312
+ parse_option(connstr.options.management_timeout, name, value, connstr.warnings);
302
313
  } else if (name == "trust_certificate") {
303
- parse_option(connstr.options.trust_certificate, name, value);
314
+ parse_option(connstr.options.trust_certificate, name, value, connstr.warnings);
304
315
  } else if (name == "enable_mutation_tokens") {
305
316
  /**
306
317
  * Request mutation tokens at connection negotiation time. Turning this off will save 16 bytes per operation response.
307
318
  */
308
- parse_option(connstr.options.enable_mutation_tokens, name, value);
319
+ parse_option(connstr.options.enable_mutation_tokens, name, value, connstr.warnings);
309
320
  } else if (name == "enable_tcp_keep_alive") {
310
321
  /**
311
322
  * Gets or sets a value indicating whether enable TCP keep-alive.
312
323
  */
313
- parse_option(connstr.options.enable_tcp_keep_alive, name, value);
324
+ parse_option(connstr.options.enable_tcp_keep_alive, name, value, connstr.warnings);
314
325
  } else if (name == "tcp_keep_alive_interval") {
315
326
  /**
316
327
  * Specifies the timeout, in milliseconds, with no activity until the first keep-alive packet is sent. This applies to all
317
328
  * services, but is advisory: if the underlying platform does not support this on all connections, it will be applied only
318
329
  * on those it can be.
319
330
  */
320
- parse_option(connstr.options.tcp_keep_alive_interval, name, value);
331
+ parse_option(connstr.options.tcp_keep_alive_interval, name, value, connstr.warnings);
321
332
  } else if (name == "force_ipv4") {
322
333
  /**
323
334
  * Sets the SDK configuration to do IPv4 Name Resolution
324
335
  */
325
336
  bool force_ipv4 = false;
326
- parse_option(force_ipv4, name, value);
337
+ parse_option(force_ipv4, name, value, connstr.warnings);
327
338
  if (force_ipv4) {
328
339
  connstr.options.use_ip_protocol = io::ip_protocol::force_ipv4;
329
340
  }
@@ -331,40 +342,40 @@ extract_options(connection_string& connstr)
331
342
  /**
332
343
  * Controls preference of IP protocol for name resolution
333
344
  */
334
- parse_option(connstr.options.use_ip_protocol, name, value);
345
+ parse_option(connstr.options.use_ip_protocol, name, value, connstr.warnings);
335
346
  } else if (name == "config_poll_interval") {
336
- parse_option(connstr.options.config_poll_interval, name, value);
347
+ parse_option(connstr.options.config_poll_interval, name, value, connstr.warnings);
337
348
  } else if (name == "config_poll_floor") {
338
- parse_option(connstr.options.config_poll_floor, name, value);
349
+ parse_option(connstr.options.config_poll_floor, name, value, connstr.warnings);
339
350
  } else if (name == "max_http_connections") {
340
351
  /**
341
352
  * The maximum number of HTTP connections allowed on a per-host and per-port basis. 0 indicates an unlimited number of
342
353
  * connections are permitted.
343
354
  */
344
- parse_option(connstr.options.max_http_connections, name, value);
355
+ parse_option(connstr.options.max_http_connections, name, value, connstr.warnings);
345
356
  } else if (name == "idle_http_connection_timeout") {
346
357
  /**
347
358
  * The period of time an HTTP connection can be idle before it is forcefully disconnected.
348
359
  */
349
- parse_option(connstr.options.idle_http_connection_timeout, name, value);
360
+ parse_option(connstr.options.idle_http_connection_timeout, name, value, connstr.warnings);
350
361
  } else if (name == "bootstrap_timeout") {
351
362
  /**
352
363
  * The period of time allocated to complete bootstrap
353
364
  */
354
- parse_option(connstr.options.bootstrap_timeout, name, value);
365
+ parse_option(connstr.options.bootstrap_timeout, name, value, connstr.warnings);
355
366
  } else if (name == "resolve_timeout") {
356
367
  /**
357
368
  * The period of time to resolve DNS name of the node to IP address
358
369
  */
359
- parse_option(connstr.options.resolve_timeout, name, value);
370
+ parse_option(connstr.options.resolve_timeout, name, value, connstr.warnings);
360
371
  } else if (name == "enable_dns_srv") {
361
372
  if (connstr.bootstrap_nodes.size() == 1) {
362
- parse_option(connstr.options.enable_dns_srv, name, value);
373
+ parse_option(connstr.options.enable_dns_srv, name, value, connstr.warnings);
363
374
  } else {
364
- CB_LOG_WARNING(
365
- R"(parameter "{}" require single entry in bootstrap nodes list of the connection string, ignoring (value "{}"))",
375
+ connstr.warnings.push_back(fmt::format(
376
+ R"(parameter "{}" requires single entry in bootstrap nodes list of the connection string, ignoring (value "{}"))",
366
377
  name,
367
- value);
378
+ value));
368
379
  }
369
380
  } else if (name == "network") {
370
381
  connstr.options.network = value; /* current known values are "auto", "default" and "external" */
@@ -372,49 +383,51 @@ extract_options(connection_string& connstr)
372
383
  /**
373
384
  * Whether to display N1QL, Analytics, Search queries on info level (default false)
374
385
  */
375
- parse_option(connstr.options.show_queries, name, value);
386
+ parse_option(connstr.options.show_queries, name, value, connstr.warnings);
376
387
  } else if (name == "enable_clustermap_notification") {
377
388
  /**
378
389
  * Allow the server to push configuration updates asynchronously.
379
390
  */
380
- parse_option(connstr.options.enable_clustermap_notification, name, value);
391
+ parse_option(connstr.options.enable_clustermap_notification, name, value, connstr.warnings);
381
392
  } else if (name == "enable_unordered_execution") {
382
393
  /**
383
394
  * Allow the server to reorder commands
384
395
  */
385
- parse_option(connstr.options.enable_unordered_execution, name, value);
396
+ parse_option(connstr.options.enable_unordered_execution, name, value, connstr.warnings);
386
397
  } else if (name == "enable_compression") {
387
398
  /**
388
399
  * Announce support of compression (snappy) to server
389
400
  */
390
- parse_option(connstr.options.enable_compression, name, value);
401
+ parse_option(connstr.options.enable_compression, name, value, connstr.warnings);
391
402
  } else if (name == "enable_tracing") {
392
403
  /**
393
404
  * true - use threshold_logging_tracer
394
405
  * false - use noop_tracer
395
406
  */
396
- parse_option(connstr.options.enable_tracing, name, value);
407
+ parse_option(connstr.options.enable_tracing, name, value, connstr.warnings);
397
408
  } else if (name == "enable_metrics") {
398
409
  /**
399
410
  * true - use logging_meter
400
411
  * false - use noop_meter
401
412
  */
402
- parse_option(connstr.options.enable_metrics, name, value);
413
+ parse_option(connstr.options.enable_metrics, name, value, connstr.warnings);
403
414
  } else if (name == "tls_verify") {
404
- parse_option(connstr.options.tls_verify, name, value);
415
+ parse_option(connstr.options.tls_verify, name, value, connstr.warnings);
416
+ } else if (name == "disable_mozilla_ca_certificates") {
417
+ parse_option(connstr.options.disable_mozilla_ca_certificates, name, value, connstr.warnings);
405
418
  } else if (name == "user_agent_extra") {
406
419
  /**
407
420
  * string, that will be appended to identification fields of the server protocols (key in HELO packet for MCBP, "user-agent"
408
421
  * header for HTTP)
409
422
  */
410
- parse_option(connstr.options.user_agent_extra, name, value);
423
+ parse_option(connstr.options.user_agent_extra, name, value, connstr.warnings);
411
424
  } else if (name == "dump_configuration") {
412
425
  /**
413
426
  * Whether to dump every new configuration on TRACE level
414
427
  */
415
- parse_option(connstr.options.dump_configuration, name, value);
428
+ parse_option(connstr.options.dump_configuration, name, value, connstr.warnings);
416
429
  } else {
417
- CB_LOG_WARNING(R"(unknown parameter "{}" in connection string (value "{}"))", name, value);
430
+ connstr.warnings.push_back(fmt::format(R"(unknown parameter "{}" in connection string (value "{}"))", name, value));
418
431
  }
419
432
  }
420
433
  }
@@ -68,6 +68,7 @@ struct connection_string {
68
68
  bootstrap_mode default_mode{ connection_string::bootstrap_mode::gcccp };
69
69
  std::uint16_t default_port{ 11210 };
70
70
 
71
+ std::vector<std::string> warnings{};
71
72
  std::optional<std::string> error{};
72
73
  };
73
74
 
@@ -57,7 +57,7 @@ class analytics_error_context : public error_context
57
57
  std::string http_body,
58
58
  std::string hostname,
59
59
  std::uint16_t port)
60
- : error_context{ ec, std::move(last_dispatched_to), std::move(last_dispatched_from), retry_attempts, std::move(retry_reasons) }
60
+ : error_context{ {}, ec, std::move(last_dispatched_to), std::move(last_dispatched_from), retry_attempts, std::move(retry_reasons) }
61
61
  , first_error_code_{ first_error_code }
62
62
  , first_error_message_{ std::move(first_error_message) }
63
63
  , client_context_id_{ std::move(client_context_id) }
@@ -0,0 +1,77 @@
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 <couchbase/search_query.hxx>
21
+
22
+ #include <optional>
23
+ #include <string>
24
+
25
+ namespace couchbase
26
+ {
27
+ /**
28
+ * Allow to match `true`/`false` in a field mapped as boolean.
29
+ *
30
+ * @since 1.0.0
31
+ * @committed
32
+ */
33
+ class boolean_field_query : public search_query
34
+ {
35
+ public:
36
+ /**
37
+ * Create a new boolean field query.
38
+ *
39
+ * @param value the input string to be matched against
40
+ *
41
+ * @since 1.0.0
42
+ * @committed
43
+ */
44
+ explicit boolean_field_query(bool value)
45
+ : bool_{ value }
46
+ {
47
+ }
48
+
49
+ /**
50
+ * If a field is specified, only terms in that field will be matched.
51
+ *
52
+ * @param field_name name of the field to be matched
53
+ *
54
+ * @return this query for chaining purposes.
55
+ *
56
+ * @since 1.0.0
57
+ * @committed
58
+ */
59
+ auto field(std::string field_name) -> boolean_field_query&
60
+ {
61
+ field_ = std::move(field_name);
62
+ return *this;
63
+ }
64
+
65
+ /**
66
+ * @return encoded representation of the query.
67
+ *
68
+ * @since 1.0.0
69
+ * @internal
70
+ */
71
+ [[nodiscard]] auto encode() const -> encoded_search_query override;
72
+
73
+ private:
74
+ bool bool_;
75
+ std::optional<std::string> field_{};
76
+ };
77
+ } // namespace couchbase
@@ -0,0 +1,223 @@
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 <couchbase/conjunction_query.hxx>
21
+ #include <couchbase/disjunction_query.hxx>
22
+ #include <couchbase/match_all_query.hxx>
23
+ #include <couchbase/match_none_query.hxx>
24
+ #include <couchbase/search_query.hxx>
25
+
26
+ #include <cstdint>
27
+ #include <memory>
28
+ #include <vector>
29
+
30
+ namespace couchbase
31
+ {
32
+ /**
33
+ * The boolean query is a useful combination of conjunction and disjunction queries. A boolean query takes three lists of queries:
34
+ *
35
+ * * **must** - result documents must satisfy all of these queries.
36
+ * * **should** - result documents should satisfy these queries.
37
+ * * **must not** - result documents must not satisfy any of these queries.
38
+ *
39
+ * At execution, a boolean query that has no child queries in any 3 categories is not allowed and will fail fast.
40
+ *
41
+ * The inner representation of child queries in the `must`/`must_not`/`should` sections are respectively a @ref conjunction_query and two
42
+ * @ref disjunction_query.
43
+ *
44
+ * In the example below the following rules enforced by the boolean query:
45
+ * * retrieved documents MUST match `"hostel room"` in their `reviews.content` field AND have `true` in `free_breakfast` field.
46
+ * * also the documents SHOULD have EITHER `reviews.ratings.Overall > 4` OR `reviews.ratings.Service > 5`.
47
+ * * and finally, exclude documents with `city` `"Padfield"` or `"Gilingham"`.
48
+ *
49
+ * @snippet test_unit_search.cxx search-boolean
50
+ *
51
+ * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-boolean-field-query.html server documentation
52
+ *
53
+ * @since 1.0.0
54
+ * @committed
55
+ */
56
+ class boolean_query : public search_query
57
+ {
58
+ public:
59
+ /**
60
+ * Set @ref conjunction_query that groups all queries the documents **must** satisfy.
61
+ *
62
+ * @param query must-query
63
+ *
64
+ * @return this query for chaining purposes.
65
+ *
66
+ * @since 1.0.0
67
+ * @committed
68
+ */
69
+ auto must(conjunction_query query) -> boolean_query&
70
+ {
71
+ must_ = std::move(query);
72
+ return *this;
73
+ }
74
+
75
+ /**
76
+ * Create @ref conjunction_query with given queries and set it as **must** query.
77
+ *
78
+ * @tparam SearchQuery any subclass of @ref search_query
79
+ * @param queries
80
+ *
81
+ * @return this query for chaining purposes.
82
+ *
83
+ * @since 1.0.0
84
+ * @committed
85
+ */
86
+ template<typename... SearchQuery>
87
+ auto must(SearchQuery... queries) -> boolean_query&
88
+ {
89
+ must_ = conjunction_query(queries...);
90
+ return *this;
91
+ }
92
+
93
+ /**
94
+ * Returns @ref conjunction_query that groups all queries the documents **must** satisfy. Use it to add more queries.
95
+ *
96
+ * @return must-query
97
+ *
98
+ * @since 1.0.0
99
+ * @committed
100
+ */
101
+ auto must() -> conjunction_query&
102
+ {
103
+ if (!must_) {
104
+ must_ = conjunction_query();
105
+ }
106
+ return must_.value();
107
+ }
108
+
109
+ /**
110
+ * Set @ref disjunction_query that groups queries the documents **should** satisfy.
111
+ *
112
+ * @param query should-query
113
+ *
114
+ * @return this query for chaining purposes.
115
+ *
116
+ * @since 1.0.0
117
+ * @committed
118
+ */
119
+ auto should(disjunction_query query) -> boolean_query&
120
+ {
121
+ should_ = std::move(query);
122
+ return *this;
123
+ }
124
+
125
+ /**
126
+ * Create @ref disjunction_query with given queries and set it as **should** query.
127
+ *
128
+ * @tparam SearchQuery any subclass of @ref search_query
129
+ * @param queries
130
+ *
131
+ * @return this query for chaining purposes.
132
+ *
133
+ * @since 1.0.0
134
+ * @committed
135
+ */
136
+ template<typename... SearchQuery>
137
+ auto should(SearchQuery... queries) -> boolean_query&
138
+ {
139
+ should_ = disjunction_query(queries...);
140
+ return *this;
141
+ }
142
+
143
+ /**
144
+ * Returns @ref disjunction_query that groups queries the documents **should** satisfy. Use it to add more queries or change
145
+ * @ref disjunction_query#min.
146
+ *
147
+ * @return should-query
148
+ *
149
+ * @since 1.0.0
150
+ * @committed
151
+ */
152
+ auto should() -> disjunction_query&
153
+ {
154
+ if (!should_) {
155
+ should_ = disjunction_query();
156
+ }
157
+ return should_.value();
158
+ }
159
+
160
+ /**
161
+ * Set @ref disjunction_query that groups queries the documents **must not** satisfy.
162
+ *
163
+ * @param query must_not-query
164
+ *
165
+ * @return this query for chaining purposes.
166
+ *
167
+ * @since 1.0.0
168
+ * @committed
169
+ */
170
+ auto must_not(disjunction_query query) -> boolean_query&
171
+ {
172
+ must_not_ = std::move(query);
173
+ return *this;
174
+ }
175
+
176
+ /**
177
+ * Create @ref disjunction_query with given queries and set it as **must not** query.
178
+ *
179
+ * @tparam SearchQuery any subclass of @ref search_query
180
+ * @param queries
181
+ *
182
+ * @return this query for chaining purposes.
183
+ *
184
+ * @since 1.0.0
185
+ * @committed
186
+ */
187
+ template<typename... SearchQuery>
188
+ auto must_not(SearchQuery... queries) -> boolean_query&
189
+ {
190
+ must_not_ = disjunction_query(queries...);
191
+ return *this;
192
+ }
193
+
194
+ /**
195
+ * Returns @ref disjunction_query that groups queries the documents **should** satisfy. Use it to add more queries.
196
+ *
197
+ * @return must_not-query
198
+ *
199
+ * @since 1.0.0
200
+ * @committed
201
+ */
202
+ auto must_not() -> disjunction_query&
203
+ {
204
+ if (!must_not_) {
205
+ must_not_ = disjunction_query();
206
+ }
207
+ return must_not_.value();
208
+ }
209
+
210
+ /**
211
+ * @return encoded representation of the query.
212
+ *
213
+ * @since 1.0.0
214
+ * @internal
215
+ */
216
+ [[nodiscard]] auto encode() const -> encoded_search_query override;
217
+
218
+ private:
219
+ std::optional<conjunction_query> must_{};
220
+ std::optional<disjunction_query> should_{};
221
+ std::optional<disjunction_query> must_not_{};
222
+ };
223
+ } // namespace couchbase
@@ -22,6 +22,8 @@
22
22
  #include <couchbase/cluster_options.hxx>
23
23
  #include <couchbase/query_index_manager.hxx>
24
24
  #include <couchbase/query_options.hxx>
25
+ #include <couchbase/search_options.hxx>
26
+ #include <couchbase/search_query.hxx>
25
27
  #include <couchbase/transactions.hxx>
26
28
 
27
29
  #include <memory>
@@ -166,6 +168,43 @@ class cluster
166
168
  return future;
167
169
  }
168
170
 
171
+ /**
172
+ * Performs a query against the full text search services.
173
+ *
174
+ * @param index_name name of the search index
175
+ * @param query query object, see hierarchy of @ref search_query for more details.
176
+ * @param options options to customize the query request.
177
+ * @param handler the handler that implements @ref search_handler
178
+ *
179
+ * @exception errc::common::ambiguous_timeout
180
+ * @exception errc::common::unambiguous_timeout
181
+ *
182
+ * @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
183
+ *
184
+ * @since 1.0.0
185
+ * @committed
186
+ */
187
+ void search_query(std::string index_name, const search_query& query, const search_options& options, search_handler&& handler) const;
188
+
189
+ /**
190
+ * Performs a query against the full text search services.
191
+ *
192
+ * @param index_name name of the search index
193
+ * @param query query object, see hierarchy of @ref search_query for more details.
194
+ * @param options options to customize the query request.
195
+ * @return future object that carries result of the operation
196
+ *
197
+ * @exception errc::common::ambiguous_timeout
198
+ * @exception errc::common::unambiguous_timeout
199
+ *
200
+ * @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
201
+ *
202
+ * @since 1.0.0
203
+ * @committed
204
+ */
205
+ [[nodiscard]] auto search_query(std::string index_name, const class search_query& query, const search_options& options = {}) const
206
+ -> std::future<std::pair<search_error_context, search_result>>;
207
+
169
208
  /**
170
209
  * Performs a query against the analytics services.
171
210
  *