couchbase 4.2.9 → 4.2.10

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
  2. package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
  3. package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
  4. package/deps/couchbase-cxx-client/core/bucket.cxx +52 -2
  5. package/deps/couchbase-cxx-client/core/bucket.hxx +1 -1
  6. package/deps/couchbase-cxx-client/core/cluster.cxx +38 -0
  7. package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
  8. package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
  9. package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
  10. package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
  11. package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
  12. package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
  13. package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
  14. package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
  15. package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
  16. package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
  17. package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
  18. package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
  19. package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +24 -32
  20. package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +1 -0
  21. package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
  22. package/deps/couchbase-cxx-client/core/meta/features.hxx +10 -0
  23. package/deps/couchbase-cxx-client/core/operations/document_query.cxx +6 -1
  24. package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
  25. package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
  26. package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +7 -6
  27. package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
  28. package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
  29. package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
  30. package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -0
  31. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +17 -1
  32. package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
  33. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
  34. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
  35. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
  36. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
  37. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
  38. package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
  39. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
  40. package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
  41. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
  42. package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
  43. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
  44. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
  45. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
  46. package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
  47. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
  48. package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
  49. package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
  50. package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
  51. package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +4 -0
  52. package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
  53. package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
  54. package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
  55. package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
  56. package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
  57. package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
  58. package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
  59. package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
  60. package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
  61. package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
  62. package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
  63. package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
  64. package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
  65. package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
  66. package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
  67. package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
  68. package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
  69. package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
  70. package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
  71. package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
  72. package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
  73. package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
  74. package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
  75. package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
  76. package/dist/binding.d.ts +9 -0
  77. package/dist/binding.js +4 -1
  78. package/dist/bindingutilities.d.ts +6 -1
  79. package/dist/bindingutilities.js +15 -1
  80. package/dist/cluster.d.ts +12 -1
  81. package/dist/cluster.js +22 -0
  82. package/dist/couchbase.d.ts +1 -0
  83. package/dist/couchbase.js +1 -0
  84. package/dist/searchexecutor.d.ts +2 -2
  85. package/dist/searchexecutor.js +19 -3
  86. package/dist/searchtypes.d.ts +46 -0
  87. package/dist/searchtypes.js +81 -1
  88. package/dist/vectorsearch.d.ts +99 -0
  89. package/dist/vectorsearch.js +132 -0
  90. package/package.json +7 -7
  91. package/src/constants.cpp +11 -0
  92. package/src/jstocbpp_autogen.hpp +24 -7
  93. package/tools/gen-bindings-json.py +2 -0
@@ -89,6 +89,15 @@ class scope_impl
89
89
  });
90
90
  }
91
91
 
92
+ void search(std::string index_name, couchbase::search_request request, search_options::built options, search_handler&& handler) const
93
+ {
94
+ return core_.execute(core::impl::build_search_request(std::move(index_name), std::move(request), options, bucket_name_, name_),
95
+ [handler = std::move(handler)](auto&& resp) mutable {
96
+ return handler(search_error_context{ internal_search_error_context{ resp } },
97
+ search_result{ internal_search_result{ resp } });
98
+ });
99
+ }
100
+
92
101
  private:
93
102
  core::cluster core_;
94
103
  std::string bucket_name_;
@@ -153,20 +162,26 @@ scope::analytics_query(std::string statement, const analytics_options& options)
153
162
  }
154
163
 
155
164
  void
156
- scope::search_query(std::string index_name, const class search_query& query, const search_options& options, search_handler&& handler) const
165
+ scope::search(std::string index_name, search_request request, const search_options& options, search_handler&& handler) const
157
166
  {
158
- return impl_->search_query(std::move(index_name), query, options.build(), std::move(handler));
167
+ return impl_->search(std::move(index_name), std::move(request), options.build(), std::move(handler));
159
168
  }
160
169
 
161
170
  auto
162
- scope::search_query(std::string index_name, const class search_query& query, const search_options& options) const
171
+ scope::search(std::string index_name, search_request request, const search_options& options) const
163
172
  -> std::future<std::pair<search_error_context, search_result>>
164
173
  {
165
174
  auto barrier = std::make_shared<std::promise<std::pair<search_error_context, search_result>>>();
166
175
  auto future = barrier->get_future();
167
- search_query(std::move(index_name), query, options, [barrier](auto ctx, auto result) {
176
+ search(std::move(index_name), std::move(request), options, [barrier](auto ctx, auto result) {
168
177
  barrier->set_value({ std::move(ctx), std::move(result) });
169
178
  });
170
179
  return future;
171
180
  }
181
+
182
+ auto
183
+ scope::search_indexes() const -> scope_search_index_manager
184
+ {
185
+ return scope_search_index_manager{ impl_->core(), impl_->bucket_name(), impl_->name() };
186
+ }
172
187
  } // namespace couchbase
@@ -26,6 +26,8 @@
26
26
  #include "internal_term_facet_result.hxx"
27
27
 
28
28
  #include <couchbase/cluster.hxx>
29
+ #include <couchbase/match_none_query.hxx>
30
+ #include <utility>
29
31
 
30
32
  #include <fmt/core.h>
31
33
 
@@ -102,14 +104,29 @@ map_raw(std::map<std::string, codec::binary, std::less<>>& raw)
102
104
  }
103
105
  return core_raw;
104
106
  }
107
+
108
+ static std::optional<core::vector_query_combination>
109
+ map_vector_query_combination(const std::optional<couchbase::vector_query_combination>& combination)
110
+ {
111
+ if (combination) {
112
+ switch (combination.value()) {
113
+ case couchbase::vector_query_combination::combination_and:
114
+ return core::vector_query_combination::combination_and;
115
+ case couchbase::vector_query_combination::combination_or:
116
+ return core::vector_query_combination::combination_or;
117
+ }
118
+ }
119
+ return {};
120
+ }
121
+
105
122
  } // namespace
106
123
 
107
124
  core::operations::search_request
108
125
  build_search_request(std::string index_name,
109
126
  const search_query& query,
110
127
  search_options::built options,
111
- std::optional<std::string> /* bucket_name */,
112
- std::optional<std::string> /* scope_name */)
128
+ std::optional<std::string> bucket_name,
129
+ std::optional<std::string> scope_name)
113
130
  {
114
131
  auto encoded = query.encode();
115
132
  if (encoded.ec) {
@@ -118,6 +135,11 @@ build_search_request(std::string index_name,
118
135
  core::operations::search_request request{
119
136
  std::move(index_name),
120
137
  core::utils::json::generate_binary(encoded.query),
138
+ std::move(bucket_name),
139
+ std::move(scope_name),
140
+ {},
141
+ {},
142
+ {},
121
143
  options.limit,
122
144
  options.skip,
123
145
  options.explain,
@@ -139,4 +161,55 @@ build_search_request(std::string index_name,
139
161
  return request;
140
162
  }
141
163
 
164
+ core::operations::search_request
165
+ build_search_request(std::string index_name,
166
+ couchbase::search_request request,
167
+ search_options::built options,
168
+ std::optional<std::string> bucket_name,
169
+ std::optional<std::string> scope_name)
170
+ {
171
+ if (!request.search_query().has_value()) {
172
+ request.search_query(couchbase::match_none_query{});
173
+ }
174
+
175
+ core::operations::search_request core_request{
176
+ std::move(index_name),
177
+ core::utils::json::generate_binary(request.search_query().value().query),
178
+ std::move(bucket_name),
179
+ std::move(scope_name),
180
+ false,
181
+ {},
182
+ {},
183
+ options.limit,
184
+ options.skip,
185
+ options.explain,
186
+ options.disable_scoring,
187
+ options.include_locations,
188
+ map_highlight_style(options.highlight_style),
189
+ options.highlight_fields,
190
+ options.fields,
191
+ options.collections,
192
+ map_scan_consistency(options.scan_consistency),
193
+ options.mutation_state,
194
+ map_sort(options.sort, options.sort_string),
195
+ map_facets(options.facets),
196
+ map_raw(options.raw),
197
+ {},
198
+ options.client_context_id,
199
+ options.timeout,
200
+ };
201
+
202
+ if (!request.vector_search().has_value()) {
203
+ return core_request;
204
+ }
205
+ core_request.vector_search = core::utils::json::generate_binary(request.vector_search().value().query);
206
+
207
+ auto vector_search_options = request.vector_options();
208
+ if (!vector_search_options.has_value()) {
209
+ return core_request;
210
+ }
211
+
212
+ core_request.vector_query_combination = map_vector_query_combination(vector_search_options.value().combination);
213
+ return core_request;
214
+ }
142
215
  } // namespace couchbase::core::impl
@@ -21,6 +21,7 @@
21
21
 
22
22
  #include <couchbase/search_options.hxx>
23
23
  #include <couchbase/search_query.hxx>
24
+ #include <couchbase/search_request.hxx>
24
25
 
25
26
  #include <optional>
26
27
  #include <string>
@@ -34,4 +35,11 @@ build_search_request(std::string index_name,
34
35
  std::optional<std::string> bucket_name,
35
36
  std::optional<std::string> scope_name);
36
37
 
38
+ core::operations::search_request
39
+ build_search_request(std::string index_name,
40
+ search_request request,
41
+ search_options::built options,
42
+ std::optional<std::string> bucket_name,
43
+ std::optional<std::string> scope_name);
44
+
37
45
  } // namespace couchbase::core::impl
@@ -29,6 +29,7 @@
29
29
  #include "core/utils/json.hxx"
30
30
  #include "internal_manager_error_context.hxx"
31
31
 
32
+ #include <couchbase/scope_search_index_manager.hxx>
32
33
  #include <couchbase/search_index_manager.hxx>
33
34
 
34
35
  #include <memory>
@@ -145,19 +146,26 @@ class search_index_manager_impl
145
146
  {
146
147
  }
147
148
 
149
+ explicit search_index_manager_impl(core::cluster core, std::string bucket_name, std::string scope_name)
150
+ : core_{ std::move(core) }
151
+ , bucket_name_{ std::move(bucket_name) }
152
+ , scope_name_{ std::move(scope_name) }
153
+ {
154
+ }
155
+
148
156
  void get_index(std::string index_name,
149
157
  const couchbase::get_search_index_options::built& options,
150
158
  get_search_index_handler&& handler) const
151
159
  {
152
160
  core_.execute(
153
- core::operations::management::search_index_get_request{ std::move(index_name), {}, options.timeout },
161
+ core::operations::management::search_index_get_request{ std::move(index_name), bucket_name_, scope_name_, {}, options.timeout },
154
162
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), map_search_index(resp.index)); });
155
163
  }
156
164
 
157
165
  void get_all_indexes(const get_all_search_indexes_options::built& options, get_all_search_indexes_handler&& handler) const
158
166
  {
159
167
  core_.execute(
160
- core::operations::management::search_index_get_all_request{ {}, options.timeout },
168
+ core::operations::management::search_index_get_all_request{ bucket_name_, scope_name_, {}, options.timeout },
161
169
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), map_all_search_indexes(resp.indexes)); });
162
170
  }
163
171
 
@@ -165,30 +173,37 @@ class search_index_manager_impl
165
173
  const upsert_search_index_options::built& options,
166
174
  upsert_search_index_handler&& handler) const
167
175
  {
168
- core_.execute(core::operations::management::search_index_upsert_request{ map_search_index(search_index), {}, options.timeout },
169
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
176
+ core_.execute(
177
+ core::operations::management::search_index_upsert_request{
178
+ map_search_index(search_index), bucket_name_, scope_name_, {}, options.timeout },
179
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
170
180
  }
171
181
 
172
182
  void drop_index(std::string index_name, const drop_search_index_options::built& options, drop_search_index_handler&& handler) const
173
183
  {
174
- core_.execute(core::operations::management::search_index_drop_request{ std::move(index_name), {}, options.timeout },
175
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
184
+ core_.execute(
185
+ core::operations::management::search_index_drop_request{ std::move(index_name), bucket_name_, scope_name_, {}, options.timeout },
186
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
176
187
  }
177
188
 
178
189
  void get_indexed_documents_count(std::string index_name,
179
190
  const get_indexed_search_index_options::built& options,
180
191
  get_indexed_search_index_handler&& handler) const
181
192
  {
182
- core_.execute(core::operations::management::search_index_get_documents_count_request{ std::move(index_name), {}, options.timeout },
183
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), resp.count); });
193
+ core_.execute(
194
+ core::operations::management::search_index_get_documents_count_request{
195
+ std::move(index_name), bucket_name_, scope_name_, {}, options.timeout },
196
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), resp.count); });
184
197
  }
185
198
 
186
199
  void pause_ingest(std::string index_name,
187
200
  const pause_ingest_search_index_options::built& options,
188
201
  pause_ingest_search_index_handler&& handler) const
189
202
  {
190
- core_.execute(core::operations::management::search_index_control_ingest_request{ std::move(index_name), true, {}, options.timeout },
191
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
203
+ core_.execute(
204
+ core::operations::management::search_index_control_ingest_request{
205
+ std::move(index_name), true, bucket_name_, scope_name_, {}, options.timeout },
206
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
192
207
  }
193
208
 
194
209
  void resume_ingest(std::string index_name,
@@ -196,7 +211,8 @@ class search_index_manager_impl
196
211
  resume_ingest_search_index_handler&& handler) const
197
212
  {
198
213
  core_.execute(
199
- core::operations::management::search_index_control_ingest_request{ std::move(index_name), false, {}, options.timeout },
214
+ core::operations::management::search_index_control_ingest_request{
215
+ std::move(index_name), false, bucket_name_, scope_name_, {}, options.timeout },
200
216
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
201
217
  }
202
218
 
@@ -204,16 +220,20 @@ class search_index_manager_impl
204
220
  const allow_querying_search_index_options::built& options,
205
221
  allow_querying_search_index_handler&& handler) const
206
222
  {
207
- core_.execute(core::operations::management::search_index_control_query_request{ std::move(index_name), true, {}, options.timeout },
208
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
223
+ core_.execute(
224
+ core::operations::management::search_index_control_query_request{
225
+ std::move(index_name), true, bucket_name_, scope_name_, {}, options.timeout },
226
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
209
227
  }
210
228
 
211
229
  void disallow_querying(std::string index_name,
212
230
  const disallow_querying_search_index_options::built& options,
213
231
  disallow_querying_search_index_handler&& handler) const
214
232
  {
215
- core_.execute(core::operations::management::search_index_control_query_request{ std::move(index_name), false, {}, options.timeout },
216
- [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
233
+ core_.execute(
234
+ core::operations::management::search_index_control_query_request{
235
+ std::move(index_name), false, bucket_name_, scope_name_, {}, options.timeout },
236
+ [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
217
237
  }
218
238
 
219
239
  void freeze_plan(std::string index_name,
@@ -221,7 +241,8 @@ class search_index_manager_impl
221
241
  freeze_plan_search_index_handler&& handler) const
222
242
  {
223
243
  core_.execute(
224
- core::operations::management::search_index_control_plan_freeze_request{ std::move(index_name), true, {}, options.timeout },
244
+ core::operations::management::search_index_control_plan_freeze_request{
245
+ std::move(index_name), true, bucket_name_, scope_name_, {}, options.timeout },
225
246
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
226
247
  }
227
248
 
@@ -230,7 +251,8 @@ class search_index_manager_impl
230
251
  unfreeze_plan_search_index_handler&& handler) const
231
252
  {
232
253
  core_.execute(
233
- core::operations::management::search_index_control_plan_freeze_request{ std::move(index_name), false, {}, options.timeout },
254
+ core::operations::management::search_index_control_plan_freeze_request{
255
+ std::move(index_name), false, bucket_name_, scope_name_, {}, options.timeout },
234
256
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp)); });
235
257
  }
236
258
 
@@ -241,12 +263,14 @@ class search_index_manager_impl
241
263
  {
242
264
  core_.execute(
243
265
  core::operations::management::search_index_analyze_document_request{
244
- std::move(index_name), std::move(document), {}, options.timeout },
266
+ std::move(index_name), std::move(document), bucket_name_, scope_name_, {}, options.timeout },
245
267
  [handler = std::move(handler)](auto resp) mutable { return handler(build_context(resp), convert_analysis(resp.analysis)); });
246
268
  }
247
269
 
248
270
  private:
249
271
  core::cluster core_;
272
+ std::optional<std::string> bucket_name_{};
273
+ std::optional<std::string> scope_name_{};
250
274
  };
251
275
 
252
276
  search_index_manager::search_index_manager(core::cluster core)
@@ -466,4 +490,223 @@ search_index_manager::analyze_document(std::string index_name,
466
490
  });
467
491
  return barrier->get_future();
468
492
  }
493
+
494
+ scope_search_index_manager::scope_search_index_manager(core::cluster core, std::string bucket_name, std::string scope_name)
495
+ : impl_(std::make_shared<search_index_manager_impl>(std::move(core), std::move(bucket_name), std::move(scope_name)))
496
+ {
497
+ }
498
+
499
+ void
500
+ scope_search_index_manager::get_index(std::string index_name,
501
+ const couchbase::get_search_index_options& options,
502
+ couchbase::get_search_index_handler&& handler) const
503
+ {
504
+ return impl_->get_index(std::move(index_name), options.build(), std::move(handler));
505
+ }
506
+
507
+ auto
508
+ scope_search_index_manager::get_index(std::string index_name, const couchbase::get_search_index_options& options) const
509
+ -> std::future<std::pair<manager_error_context, management::search::index>>
510
+ {
511
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, management::search::index>>>();
512
+ get_index(std::move(index_name), options, [barrier](auto ctx, auto result) mutable {
513
+ barrier->set_value(std::make_pair(std::move(ctx), std::move(result)));
514
+ });
515
+ return barrier->get_future();
516
+ }
517
+
518
+ void
519
+ scope_search_index_manager::get_all_indexes(const couchbase::get_all_search_indexes_options& options,
520
+ get_all_search_indexes_handler&& handler) const
521
+ {
522
+ return impl_->get_all_indexes(options.build(), std::move(handler));
523
+ }
524
+
525
+ auto
526
+ scope_search_index_manager::get_all_indexes(const couchbase::get_all_search_indexes_options& options) const
527
+ -> std::future<std::pair<manager_error_context, std::vector<management::search::index>>>
528
+ {
529
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<management::search::index>>>>();
530
+ get_all_indexes(options,
531
+ [barrier](auto ctx, auto result) mutable { barrier->set_value(std::make_pair(std::move(ctx), std::move(result))); });
532
+ return barrier->get_future();
533
+ }
534
+
535
+ void
536
+ scope_search_index_manager::upsert_index(const management::search::index& search_index,
537
+ const couchbase::upsert_search_index_options& options,
538
+ couchbase::upsert_search_index_handler&& handler) const
539
+ {
540
+ return impl_->upsert_index(search_index, options.build(), std::move(handler));
541
+ }
542
+
543
+ auto
544
+ scope_search_index_manager::upsert_index(const management::search::index& search_index,
545
+ const couchbase::upsert_search_index_options& options) const -> std::future<manager_error_context>
546
+ {
547
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
548
+ upsert_index(search_index, options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
549
+ return barrier->get_future();
550
+ }
551
+
552
+ void
553
+ scope_search_index_manager::drop_index(std::string index_name,
554
+ const couchbase::drop_search_index_options& options,
555
+ couchbase::drop_search_index_handler&& handler) const
556
+ {
557
+ return impl_->drop_index(std::move(index_name), options.build(), std::move(handler));
558
+ }
559
+
560
+ auto
561
+ scope_search_index_manager::drop_index(std::string index_name, const couchbase::drop_search_index_options& options) const
562
+ -> std::future<manager_error_context>
563
+ {
564
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
565
+ drop_index(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
566
+ return barrier->get_future();
567
+ }
568
+
569
+ void
570
+ scope_search_index_manager::get_indexed_documents_count(std::string index_name,
571
+ const couchbase::get_indexed_search_index_options& options,
572
+ couchbase::get_indexed_search_index_handler&& handler) const
573
+ {
574
+ return impl_->get_indexed_documents_count(std::move(index_name), options.build(), std::move(handler));
575
+ }
576
+
577
+ auto
578
+ scope_search_index_manager::get_indexed_documents_count(std::string index_name, const get_indexed_search_index_options& options) const
579
+ -> std::future<std::pair<manager_error_context, std::uint64_t>>
580
+ {
581
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::uint64_t>>>();
582
+ get_indexed_documents_count(std::move(index_name), options, [barrier](auto ctx, auto result) mutable {
583
+ barrier->set_value(std::make_pair(std::move(ctx), std::move(result)));
584
+ });
585
+ return barrier->get_future();
586
+ }
587
+
588
+ void
589
+ scope_search_index_manager::pause_ingest(std::string index_name,
590
+ const couchbase::pause_ingest_search_index_options& options,
591
+ couchbase::pause_ingest_search_index_handler&& handler) const
592
+ {
593
+ return impl_->pause_ingest(std::move(index_name), options.build(), std::move(handler));
594
+ }
595
+
596
+ auto
597
+ scope_search_index_manager::pause_ingest(std::string index_name, const couchbase::pause_ingest_search_index_options& options) const
598
+ -> std::future<manager_error_context>
599
+ {
600
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
601
+ pause_ingest(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
602
+ return barrier->get_future();
603
+ }
604
+
605
+ void
606
+ scope_search_index_manager::resume_ingest(std::string index_name,
607
+ const couchbase::resume_ingest_search_index_options& options,
608
+ couchbase::resume_ingest_search_index_handler&& handler) const
609
+ {
610
+ return impl_->resume_ingest(std::move(index_name), options.build(), std::move(handler));
611
+ }
612
+
613
+ auto
614
+ scope_search_index_manager::resume_ingest(std::string index_name, const couchbase::resume_ingest_search_index_options& options) const
615
+ -> std::future<manager_error_context>
616
+ {
617
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
618
+ resume_ingest(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
619
+ return barrier->get_future();
620
+ }
621
+
622
+ void
623
+ scope_search_index_manager::allow_querying(std::string index_name,
624
+ const couchbase::allow_querying_search_index_options& options,
625
+ couchbase::allow_querying_search_index_handler&& handler) const
626
+ {
627
+ return impl_->allow_querying(std::move(index_name), options.build(), std::move(handler));
628
+ }
629
+
630
+ auto
631
+ scope_search_index_manager::allow_querying(std::string index_name, const couchbase::allow_querying_search_index_options& options) const
632
+ -> std::future<manager_error_context>
633
+ {
634
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
635
+ allow_querying(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
636
+ return barrier->get_future();
637
+ }
638
+
639
+ void
640
+ scope_search_index_manager::disallow_querying(std::string index_name,
641
+ const couchbase::disallow_querying_search_index_options& options,
642
+ couchbase::disallow_querying_search_index_handler&& handler) const
643
+ {
644
+ return impl_->disallow_querying(std::move(index_name), options.build(), std::move(handler));
645
+ }
646
+
647
+ auto
648
+ scope_search_index_manager::disallow_querying(std::string index_name,
649
+ const couchbase::disallow_querying_search_index_options& options) const
650
+ -> std::future<manager_error_context>
651
+ {
652
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
653
+ disallow_querying(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
654
+ return barrier->get_future();
655
+ }
656
+
657
+ void
658
+ scope_search_index_manager::freeze_plan(std::string index_name,
659
+ const couchbase::freeze_plan_search_index_options& options,
660
+ couchbase::freeze_plan_search_index_handler&& handler) const
661
+ {
662
+ return impl_->freeze_plan(std::move(index_name), options.build(), std::move(handler));
663
+ }
664
+
665
+ auto
666
+ scope_search_index_manager::freeze_plan(std::string index_name, const couchbase::freeze_plan_search_index_options& options) const
667
+ -> std::future<manager_error_context>
668
+ {
669
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
670
+ freeze_plan(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
671
+ return barrier->get_future();
672
+ }
673
+
674
+ void
675
+ scope_search_index_manager::unfreeze_plan(std::string index_name,
676
+ const couchbase::unfreeze_plan_search_index_options& options,
677
+ couchbase::unfreeze_plan_search_index_handler&& handler) const
678
+ {
679
+ return impl_->unfreeze_plan(std::move(index_name), options.build(), std::move(handler));
680
+ }
681
+
682
+ auto
683
+ scope_search_index_manager::unfreeze_plan(std::string index_name, const couchbase::unfreeze_plan_search_index_options& options) const
684
+ -> std::future<manager_error_context>
685
+ {
686
+ auto barrier = std::make_shared<std::promise<manager_error_context>>();
687
+ unfreeze_plan(std::move(index_name), options, [barrier](auto ctx) mutable { barrier->set_value(std::move(ctx)); });
688
+ return barrier->get_future();
689
+ }
690
+
691
+ void
692
+ scope_search_index_manager::analyze_document(std::string index_name,
693
+ std::string document,
694
+ const couchbase::analyze_document_options& options,
695
+ couchbase::analyze_document_handler&& handler) const
696
+ {
697
+ return impl_->analyze_document(std::move(index_name), std::move(document), options.build(), std::move(handler));
698
+ }
699
+
700
+ auto
701
+ scope_search_index_manager::analyze_document(std::string index_name,
702
+ std::string document,
703
+ const couchbase::analyze_document_options& options) const
704
+ -> std::future<std::pair<manager_error_context, std::vector<std::string>>>
705
+ {
706
+ auto barrier = std::make_shared<std::promise<std::pair<manager_error_context, std::vector<std::string>>>>();
707
+ analyze_document(std::move(index_name), std::move(document), options, [barrier](auto ctx, auto result) mutable {
708
+ barrier->set_value(std::make_pair(std::move(ctx), std::move(result)));
709
+ });
710
+ return barrier->get_future();
711
+ }
469
712
  } // namespace couchbase