couchbase 4.2.3 → 4.2.5-dev.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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
@@ -0,0 +1,51 @@
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_term_range
30
+ {
31
+ public:
32
+ search_term_range(std::string name, std::uint64_t count)
33
+ : name_{ std::move(name) }
34
+ , count_{ count }
35
+ {
36
+ }
37
+
38
+ [[nodiscard]] auto name() const -> const std::string&
39
+ {
40
+ return name_;
41
+ }
42
+ [[nodiscard]] auto count() const -> std::uint64_t
43
+ {
44
+ return count_;
45
+ }
46
+
47
+ private:
48
+ std::string name_;
49
+ std::uint64_t count_;
50
+ };
51
+ } // namespace couchbase
@@ -49,6 +49,7 @@ class security_options
49
49
  bool enabled;
50
50
  tls_verify_mode tls_verify;
51
51
  std::optional<std::string> trust_certificate;
52
+ bool disable_mozilla_ca_certificates;
52
53
  };
53
54
 
54
55
  [[nodiscard]] auto build() const -> built
@@ -57,6 +58,7 @@ class security_options
57
58
  enabled_,
58
59
  tls_verify_,
59
60
  trust_certificate_,
61
+ disable_mozilla_ca_certificates_,
60
62
  };
61
63
  }
62
64
 
@@ -64,5 +66,6 @@ class security_options
64
66
  bool enabled_{ true };
65
67
  tls_verify_mode tls_verify_{ tls_verify_mode::peer };
66
68
  std::optional<std::string> trust_certificate_{};
69
+ bool disable_mozilla_ca_certificates_{ false };
67
70
  };
68
71
  } // namespace couchbase
@@ -62,7 +62,8 @@ class subdocument_error_context : public key_value_error_context
62
62
  * @since 1.0.0
63
63
  * @internal
64
64
  */
65
- subdocument_error_context(std::error_code ec,
65
+ subdocument_error_context(std::string operation_id,
66
+ std::error_code ec,
66
67
  std::optional<std::string> last_dispatched_to,
67
68
  std::optional<std::string> last_dispatched_from,
68
69
  std::size_t retry_attempts,
@@ -79,7 +80,8 @@ class subdocument_error_context : public key_value_error_context
79
80
  std::optional<std::string> first_error_path,
80
81
  std::optional<std::uint64_t> first_error_index,
81
82
  bool deleted)
82
- : key_value_error_context{ ec,
83
+ : key_value_error_context{ std::move(operation_id),
84
+ ec,
83
85
  std::move(last_dispatched_to),
84
86
  std::move(last_dispatched_from),
85
87
  retry_attempts,
@@ -0,0 +1,48 @@
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_facet.hxx>
21
+
22
+ namespace couchbase
23
+ {
24
+ /**
25
+ * A facet that gives the number of occurrences of the most recurring terms in all rows.
26
+ */
27
+ class term_facet : public search_facet
28
+ {
29
+ public:
30
+ explicit term_facet(std::string field)
31
+ : search_facet{ std::move(field) }
32
+ {
33
+ }
34
+
35
+ term_facet(std::string field, std::uint32_t size)
36
+ : search_facet{ std::move(field), size }
37
+ {
38
+ }
39
+
40
+ /**
41
+ * @return encoded representation of the search facet.
42
+ *
43
+ * @since 1.0.0
44
+ * @internal
45
+ */
46
+ [[nodiscard]] auto encode() const -> encoded_search_facet override;
47
+ };
48
+ } // namespace couchbase
@@ -0,0 +1,55 @@
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/search_facet_result.hxx>
21
+ #include <couchbase/search_term_range.hxx>
22
+
23
+ #include <string>
24
+ #include <vector>
25
+
26
+ namespace couchbase
27
+ {
28
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
29
+ class internal_term_facet_result;
30
+ #endif
31
+
32
+ /**
33
+ * @since 1.0.0
34
+ * @committed
35
+ */
36
+ class term_facet_result : public search_facet_result
37
+ {
38
+ public:
39
+ /**
40
+ * @since 1.0.0
41
+ * @internal
42
+ */
43
+ explicit term_facet_result(internal_term_facet_result internal);
44
+
45
+ [[nodiscard]] auto name() const -> const std::string& override;
46
+ [[nodiscard]] auto field() const -> const std::string& override;
47
+ [[nodiscard]] auto total() const -> std::uint64_t override;
48
+ [[nodiscard]] auto missing() const -> std::uint64_t override;
49
+ [[nodiscard]] auto other() const -> std::uint64_t override;
50
+ [[nodiscard]] auto terms() const -> const std::vector<search_term_range>&;
51
+
52
+ private:
53
+ std::unique_ptr<internal_term_facet_result> internal_;
54
+ };
55
+ } // namespace couchbase
@@ -0,0 +1,151 @@
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/match_operator.hxx>
21
+ #include <couchbase/search_query.hxx>
22
+
23
+ #include <cstdint>
24
+ #include <optional>
25
+ #include <stdexcept>
26
+ #include <string>
27
+
28
+ namespace couchbase
29
+ {
30
+ /**
31
+ * A query that looks for **exact** matches of the term in the index (no analyzer, no stemming). Useful to check what the actual content of
32
+ * the index is. It can also apply fuzziness on the term. Usual better alternative is @ref match_query.
33
+ *
34
+ * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-term.html server documentation
35
+ * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-fuzzy.html fuzzy search
36
+ *
37
+ * @since 1.0.0
38
+ * @committed
39
+ */
40
+ class term_query : public search_query
41
+ {
42
+ public:
43
+ /**
44
+ * Create a new term query.
45
+ *
46
+ * The mandatory term is the exact string that will be searched into the index. Note that the index can (and usually will) contain terms
47
+ * that are derived from the text in documents, as analyzers can apply process like stemming. For example, indexing "programming" could
48
+ * store "program" in the index. As a term query doesn't apply the analyzers, one would need to look for "program" to have a match on
49
+ * that index entry.
50
+ *
51
+ * @param term the input string to be matched against
52
+ *
53
+ * @since 1.0.0
54
+ * @committed
55
+ */
56
+ explicit term_query(std::string term)
57
+ : term_{ std::move(term) }
58
+ {
59
+ }
60
+
61
+ /**
62
+ * Require that the term also have the same prefix of the specified length (must be positive).
63
+ *
64
+ * The prefix length only makes sense when fuzziness is enabled. It allows to apply the fuzziness only on the part of the term that is
65
+ * after the `length` character mark.
66
+ *
67
+ * For example, with the term "something" and a prefix length of 4, only the "thing" part of the term will be fuzzy-searched, and hits
68
+ * must start with "some".
69
+ *
70
+ * @param length the length of the term prefix
71
+ *
72
+ * @return this query for chaining purposes.
73
+ *
74
+ * @since 1.0.0
75
+ * @committed
76
+ */
77
+ auto prefix_length(std::uint32_t length) -> term_query&
78
+ {
79
+ if (length <= 0) {
80
+ throw std::invalid_argument("prefix_length must be positive");
81
+ }
82
+
83
+ prefix_length_ = length;
84
+ return *this;
85
+ }
86
+
87
+ /**
88
+ * If a field is specified, only terms in that field will be matched.
89
+ *
90
+ * @param field_name name of the field to be matched
91
+ *
92
+ * @return this query for chaining purposes.
93
+ *
94
+ * @since 1.0.0
95
+ * @committed
96
+ */
97
+ auto field(std::string field_name) -> term_query&
98
+ {
99
+ field_ = std::move(field_name);
100
+ return *this;
101
+ }
102
+
103
+ /**
104
+ * Perform fuzzy matching. If the fuzziness parameter is set to a non-zero integer the analyzed text will be matched with the specified
105
+ * level of fuzziness.
106
+ *
107
+ * @param fuzziness level of fuzziness (the maximum supported fuzziness is 2).
108
+ *
109
+ * @return this query for chaining purposes.
110
+ *
111
+ * @since 1.0.0
112
+ * @committed
113
+ */
114
+ auto fuzziness(std::uint32_t fuzziness) -> term_query&
115
+ {
116
+ fuzziness_ = fuzziness;
117
+ return *this;
118
+ }
119
+
120
+ /**
121
+ * Defines how the individual match terms should be logically concatenated
122
+ *
123
+ * @param concatenation_operator operator to be used
124
+ *
125
+ * @return this query for chaining purposes.
126
+ *
127
+ * @since 1.0.0
128
+ * @committed
129
+ */
130
+ auto match_operator(couchbase::match_operator concatenation_operator) -> term_query&
131
+ {
132
+ operator_ = concatenation_operator;
133
+ return *this;
134
+ }
135
+
136
+ /**
137
+ * @return encoded representation of the query.
138
+ *
139
+ * @since 1.0.0
140
+ * @internal
141
+ */
142
+ [[nodiscard]] auto encode() const -> encoded_search_query override;
143
+
144
+ private:
145
+ std::string term_;
146
+ std::optional<std::uint32_t> prefix_length_{};
147
+ std::optional<std::string> field_{};
148
+ std::optional<std::uint32_t> fuzziness_{};
149
+ std::optional<couchbase::match_operator> operator_{};
150
+ };
151
+ } // namespace couchbase
@@ -0,0 +1,142 @@
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/match_operator.hxx>
21
+ #include <couchbase/search_query.hxx>
22
+
23
+ #include <optional>
24
+ #include <string>
25
+
26
+ namespace couchbase
27
+ {
28
+ /**
29
+ * The term range query finds documents containing a string value in the specified field within the specified range. Either min or max can
30
+ * be omitted, but not both.
31
+ *
32
+ * Match documents where field `desc` contains terms in the range `("foo", "foof")`:
33
+ * @snippet test_unit_search.cxx search-term-range
34
+ *
35
+ * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-term-range.html server documentation.
36
+ *
37
+ * @since 1.0.0
38
+ * @committed
39
+ */
40
+ class term_range_query : public search_query
41
+ {
42
+ public:
43
+ /**
44
+ * Set lower limit of the range. Whether to include limit into the range will be decided by server defaults.
45
+ *
46
+ * @param value lower limit of the range.
47
+ *
48
+ * @return this query for chaining purposes.
49
+ *
50
+ * @since 1.0.0
51
+ * @committed
52
+ */
53
+ auto min(std::string value) -> term_range_query&
54
+ {
55
+ min_ = std::move(value);
56
+ return *this;
57
+ }
58
+
59
+ /**
60
+ * Set lower limit and specify whether to include it into the limit.
61
+ *
62
+ * @param value lower limit of the range.
63
+ * @param inclusive whether to include limit value into the interval.
64
+ *
65
+ * @return this query for chaining purposes.
66
+ *
67
+ * @since 1.0.0
68
+ * @committed
69
+ */
70
+ auto min(std::string value, bool inclusive) -> term_range_query&
71
+ {
72
+ min_ = std::move(value);
73
+ inclusive_min_ = inclusive;
74
+ return *this;
75
+ }
76
+
77
+ /**
78
+ * Set upper limit of the range. Whether to include limit into the range will be decided by server defaults.
79
+ *
80
+ * @param value upper limit of the range
81
+ *
82
+ * @return this query for chaining purposes.
83
+ *
84
+ * @since 1.0.0
85
+ * @committed
86
+ */
87
+ auto max(std::string value) -> term_range_query&
88
+ {
89
+ max_ = std::move(value);
90
+ return *this;
91
+ }
92
+
93
+ /**
94
+ * Set upper limit and specify whether to include it into the limit.
95
+ *
96
+ * @param value upper limit of the range.
97
+ * @param inclusive whether to include limit value into the interval.
98
+ *
99
+ * @return this query for chaining purposes.
100
+ *
101
+ * @since 1.0.0
102
+ * @committed
103
+ */
104
+ auto max(std::string value, bool inclusive) -> term_range_query&
105
+ {
106
+ max_ = std::move(value);
107
+ inclusive_max_ = inclusive;
108
+ return *this;
109
+ }
110
+
111
+ /**
112
+ * If a field is specified, only terms in that field will be matched.
113
+ *
114
+ * @param field_name name of the field to be matched
115
+ *
116
+ * @return this query for chaining purposes.
117
+ *
118
+ * @since 1.0.0
119
+ * @committed
120
+ */
121
+ auto field(std::string field_name) -> term_range_query&
122
+ {
123
+ field_ = std::move(field_name);
124
+ return *this;
125
+ }
126
+
127
+ /**
128
+ * @return encoded representation of the query.
129
+ *
130
+ * @since 1.0.0
131
+ * @internal
132
+ */
133
+ [[nodiscard]] auto encode() const -> encoded_search_query override;
134
+
135
+ private:
136
+ std::optional<std::string> min_{};
137
+ std::optional<std::string> max_{};
138
+ std::optional<bool> inclusive_min_{};
139
+ std::optional<bool> inclusive_max_{};
140
+ std::optional<std::string> field_{};
141
+ };
142
+ } // namespace couchbase
@@ -25,7 +25,7 @@
25
25
  namespace couchbase::transactions
26
26
  {
27
27
  /**
28
- * The transaction_options can be passed in to override some elements of the global @ref transaction_config.
28
+ * The transaction_options can be passed in to override some elements of the global @ref transactions_config.
29
29
  */
30
30
  class transaction_options
31
31
  {
@@ -29,7 +29,8 @@ class transaction_context;
29
29
  /**
30
30
  * The transaction_query_options are options specific to a query.
31
31
  *
32
- * Some of the options will override the corresponding elements in the @ref transaction_query_config section of the @ref transaction_config.
32
+ * Some of the options will override the corresponding elements in the @ref transactions_query_config section of the
33
+ * @ref transactions_config.
33
34
  */
34
35
  class transaction_query_options
35
36
  {
@@ -25,7 +25,7 @@ namespace couchbase::transactions
25
25
  * @volatile
26
26
  *
27
27
  * Contains internal information on a transaction,
28
- * returned by @ref core::transactions::run()
28
+ * returned by @ref couchbase::transactions::transactions::run()
29
29
  */
30
30
  struct transaction_result {
31
31
  std::string transaction_id;
@@ -46,7 +46,7 @@ class transactions
46
46
  * You can supply a lambda or function which uses a yielded {@link attempt_context} to perform a transaction, where each transaction
47
47
  * operation is blocking. A simple usage would be to get a document and replace the contents:
48
48
  *
49
- * @snippet test/test_transaction_examples.cxx simple-blocking-txn
49
+ * @snippet{trimleft} test/test_transaction_examples.cxx simple-blocking-txn
50
50
  *
51
51
  * @param logic a lambda or function which uses the yielded {@link attempt_context} to perform the desired transactional operations.
52
52
  * @param cfg if passed in, these options override the defaults, or those set in the {@link cluster_options}.
@@ -62,7 +62,7 @@ class transactions
62
62
  * below, we get the 3 documents in parallel, and update each when the get returns the document. This can be significantly faster than
63
63
  * getting each document in serial, and updating it using the blocking api:
64
64
  *
65
- * @snippet test/test_transaction_examples.cxx simple-async-txn
65
+ * @snippet{trimleft} test/test_transaction_examples.cxx simple-async-txn
66
66
  *
67
67
  * @param logic a lambda or function which uses the yielded {@link async_attempt_context} to perform the desired transactional
68
68
  * operations.
@@ -73,4 +73,4 @@ class transactions
73
73
  async_txn_complete_logic&& complete_callback,
74
74
  const transaction_options& cfg = transaction_options()) = 0;
75
75
  };
76
- } // namespace couchbase::transactions
76
+ } // namespace couchbase::transactions
@@ -0,0 +1,83 @@
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
+ * A wildcard query is a query in which term the character `*` will match `0..n` occurrences of any characters and `?` will match `1`
29
+ * occurrence of any character.
30
+ *
31
+ * Match documents where field `reviews.content` contains words starting with `"inter"`:
32
+ * @snippet test_unit_search.cxx search-wildcard
33
+ *
34
+ * @see https://docs.couchbase.com/server/current/fts/fts-supported-queries-wildcard.html server documentation
35
+ *
36
+ * @since 1.0.0
37
+ * @committed
38
+ */
39
+ class wildcard_query : public search_query
40
+ {
41
+ public:
42
+ /**
43
+ * Create a new wildcard query.
44
+ *
45
+ * @param regexp the wildcard-containing term to be analyzed and searched
46
+ *
47
+ * @since 1.0.0
48
+ * @committed
49
+ */
50
+ explicit wildcard_query(std::string regexp)
51
+ : wildcard_{ std::move(regexp) }
52
+ {
53
+ }
54
+
55
+ /**
56
+ * If a field is specified, only terms in that field will be matched.
57
+ *
58
+ * @param field_name name of the field to be matched
59
+ *
60
+ * @return this query for chaining purposes.
61
+ *
62
+ * @since 1.0.0
63
+ * @committed
64
+ */
65
+ auto field(std::string field_name) -> wildcard_query&
66
+ {
67
+ field_ = std::move(field_name);
68
+ return *this;
69
+ }
70
+
71
+ /**
72
+ * @return encoded representation of the query.
73
+ *
74
+ * @since 1.0.0
75
+ * @internal
76
+ */
77
+ [[nodiscard]] auto encode() const -> encoded_search_query override;
78
+
79
+ private:
80
+ std::string wildcard_;
81
+ std::optional<std::string> field_{};
82
+ };
83
+ } // namespace couchbase
@@ -1078,7 +1078,7 @@ EXCLUDE_SYMBOLS =
1078
1078
  # that contain example code fragments that are included (see the \include
1079
1079
  # command).
1080
1080
 
1081
- EXAMPLE_PATH = ${PROJECT_SOURCE_DIR}/test/
1081
+ EXAMPLE_PATH = ${PROJECT_SOURCE_DIR}/examples/ ${PROJECT_SOURCE_DIR}/test/
1082
1082
 
1083
1083
  # If the value of the EXAMPLE_PATH tag contains directories, you can use the
1084
1084
  # EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
@@ -1,4 +1,4 @@
1
- # cbc-analytics - run Analytics query {#cbc-analytics}
1
+ # cbc-analytics - Run Analytics Query {#cbc-analytics}
2
2
 
3
3
  ### NAME
4
4
 
@@ -168,4 +168,4 @@ Execute one or more Analytics queries and print results to standard output.
168
168
 
169
169
  ### SEE ALSO
170
170
 
171
- [cbc](#cbc), [cbc-get](#cbc-get).
171
+ [cbc](md_docs_2cbc), [cbc-get](md_docs_2cbc-get).
@@ -1,4 +1,4 @@
1
- # cbc-get - get document {#cbc-get}
1
+ # cbc-get - Retrieve Documents from the Server {#cbc-get}
2
2
 
3
3
  ### NAME
4
4
 
@@ -18,6 +18,7 @@ Retrieve one or more documents from the server and print them to standard output
18
18
 
19
19
  <dl>
20
20
  <dt>`-h|--help`</dt><dd>Show help message.</dd>
21
+ <dt>`--verbose`</dt><dd>Include more context and information where it is applicable.</dd>
21
22
  <dt>`--bucket-name=STRING`</dt><dd>Name of the bucket. [default: `default`]</dd>
22
23
  <dt>`--scope-name=STRING`</dt><dd>Name of the scope. [default: `_default`]</dd>
23
24
  <dt>`--collection-name=STRING`</dt><dd>Name of the collection. [default: `_default`]</dd>
@@ -157,4 +158,4 @@ Retrieve one or more documents from the server and print them to standard output
157
158
 
158
159
  ### SEE ALSO
159
160
 
160
- [cbc](#cbc), [cbc-query](#cbc-query).
161
+ [cbc](md_docs_2cbc), [cbc-query](md_docs_2cbc-query).