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
@@ -20,8 +20,10 @@
20
20
  #include <couchbase/analytics_options.hxx>
21
21
  #include <couchbase/collection.hxx>
22
22
  #include <couchbase/query_options.hxx>
23
+ #include <couchbase/scope_search_index_manager.hxx>
23
24
  #include <couchbase/search_options.hxx>
24
25
  #include <couchbase/search_query.hxx>
26
+ #include <couchbase/search_request.hxx>
25
27
 
26
28
  #include <memory>
27
29
 
@@ -112,10 +114,12 @@ class scope
112
114
  -> std::future<std::pair<query_error_context, query_result>>;
113
115
 
114
116
  /**
115
- * Performs a query against the full text search services.
117
+ * Performs a request against the full text search services.
118
+ *
119
+ * This can be used to perform a traditional FTS query, and/or a vector search.
116
120
  *
117
121
  * @param index_name name of the search index
118
- * @param query query object, see hierarchy of @ref search_query for more details.
122
+ * @param request request object, see @ref search_request for more details.
119
123
  * @param options options to customize the query request.
120
124
  * @param handler the handler that implements @ref search_handler
121
125
  *
@@ -125,15 +129,17 @@ class scope
125
129
  * @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
126
130
  *
127
131
  * @since 1.0.0
128
- * @committed
132
+ * @volatile
129
133
  */
130
- void search_query(std::string index_name, const search_query& query, const search_options& options, search_handler&& handler) const;
134
+ void search(std::string index_name, search_request request, const search_options& options, search_handler&& handler) const;
131
135
 
132
136
  /**
133
- * Performs a query against the full text search services.
137
+ * Performs a request against the full text search services.
138
+ *
139
+ * This can be used to perform a traditional FTS query, and/or a vector search.
134
140
  *
135
141
  * @param index_name name of the search index
136
- * @param query query object, see hierarchy of @ref search_query for more details.
142
+ * @param request request object, see @ref search_request for more details.
137
143
  * @param options options to customize the query request.
138
144
  * @return future object that carries result of the operation
139
145
  *
@@ -143,9 +149,9 @@ class scope
143
149
  * @see https://docs.couchbase.com/server/current/fts/fts-introduction.html
144
150
  *
145
151
  * @since 1.0.0
146
- * @committed
152
+ * @volatile
147
153
  */
148
- [[nodiscard]] auto search_query(std::string index_name, const class search_query& query, const search_options& options = {}) const
154
+ [[nodiscard]] auto search(std::string index_name, search_request request, const search_options& = {}) const
149
155
  -> std::future<std::pair<search_error_context, search_result>>;
150
156
 
151
157
  /**
@@ -180,6 +186,16 @@ class scope
180
186
  [[nodiscard]] auto analytics_query(std::string statement, const analytics_options& options = {}) const
181
187
  -> std::future<std::pair<analytics_error_context, analytics_result>>;
182
188
 
189
+ /**
190
+ * Provides access to search index management services at the scope level
191
+ *
192
+ * @return a manager instance
193
+ *
194
+ * @since 1.0.0
195
+ * @volatile
196
+ */
197
+ [[nodiscard]] auto search_indexes() const -> scope_search_index_manager;
198
+
183
199
  private:
184
200
  friend class bucket;
185
201
 
@@ -0,0 +1,291 @@
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/allow_querying_search_index_options.hxx>
21
+ #include <couchbase/analyze_document_options.hxx>
22
+ #include <couchbase/disallow_querying_search_index_options.hxx>
23
+ #include <couchbase/drop_search_index_options.hxx>
24
+ #include <couchbase/freeze_plan_search_index_options.hxx>
25
+ #include <couchbase/get_all_search_indexes_options.hxx>
26
+ #include <couchbase/get_indexed_search_index_options.hxx>
27
+ #include <couchbase/get_search_index_options.hxx>
28
+ #include <couchbase/pause_ingest_search_index_options.hxx>
29
+ #include <couchbase/resume_ingest_search_index_options.hxx>
30
+ #include <couchbase/unfreeze_plan_search_index_options.hxx>
31
+ #include <couchbase/upsert_search_index_options.hxx>
32
+
33
+ #include <future>
34
+
35
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
36
+ namespace couchbase
37
+ {
38
+ namespace core
39
+ {
40
+ class cluster;
41
+ } // namespace core
42
+ class search_index_manager_impl;
43
+ } // namespace couchbase
44
+ #endif
45
+
46
+ namespace couchbase
47
+ {
48
+ class scope;
49
+
50
+ class scope_search_index_manager
51
+ {
52
+ public:
53
+ /**
54
+ * Fetches a scope-level index from the server if it exists
55
+ *
56
+ * @param index_name the name of the index
57
+ * @param options optional parameters
58
+ * @param handler handler that implements @ref get_search_index_handler
59
+ *
60
+ * @since 1.0.0
61
+ * @volatile
62
+ */
63
+ void get_index(std::string index_name, const get_search_index_options& options, get_search_index_handler&& handler) const;
64
+
65
+ [[nodiscard]] auto get_index(std::string index_name, const get_search_index_options& options = {}) const
66
+ -> std::future<std::pair<manager_error_context, management::search::index>>;
67
+
68
+ /**
69
+ * Fetches all scope-level indexes from the server
70
+ *
71
+ * @param options optional parameters
72
+ * @param handler handler that implements @ref get_all_search_indexes_handler
73
+ *
74
+ * @since 1.0.0
75
+ * @volatile
76
+ */
77
+ void get_all_indexes(const get_all_search_indexes_options& options, get_all_search_indexes_handler&& handler) const;
78
+
79
+ [[nodiscard]] auto get_all_indexes(const get_all_search_indexes_options& options = {}) const
80
+ -> std::future<std::pair<manager_error_context, std::vector<management::search::index>>>;
81
+
82
+ /**
83
+ * Creates, or updates a scope-level index
84
+ *
85
+ * @param search_index the index definition including name and settings
86
+ * @param options optional parameters
87
+ * @param handler handler that implements @ref upsert_search_index_handler
88
+ *
89
+ * @since 1.0.0
90
+ * @volatile
91
+ */
92
+ void upsert_index(const management::search::index& search_index,
93
+ const upsert_search_index_options& options,
94
+ upsert_search_index_handler&& handler) const;
95
+
96
+ [[nodiscard]] auto upsert_index(const management::search::index& search_index, const upsert_search_index_options& options = {}) const
97
+ -> std::future<manager_error_context>;
98
+
99
+ /**
100
+ * Drops a scope-level index
101
+ *
102
+ * @param index_name the name of the search index
103
+ * @param options optional parameters
104
+ * @param handler handler that implements @ref drop_search_index_handler
105
+ *
106
+ * @since 1.0.0
107
+ * @volatile
108
+ */
109
+ void drop_index(std::string index_name, const drop_search_index_options& options, drop_search_index_handler&& handler) const;
110
+
111
+ [[nodiscard]] auto drop_index(std::string index_name, const drop_search_index_options& options = {}) const
112
+ -> std::future<manager_error_context>;
113
+
114
+ /**
115
+ * Retrieves the number of documents that have been indexed for a scope-level index
116
+ *
117
+ * @param index_name the name of the search index
118
+ * @param options optional parameters
119
+ * @param handler handler that implements @ref get_indexed_search_index_handler
120
+ *
121
+ * @since 1.0.0
122
+ * @volatile
123
+ */
124
+ void get_indexed_documents_count(std::string index_name,
125
+ const get_indexed_search_index_options& options,
126
+ get_indexed_search_index_handler&& handler) const;
127
+
128
+ [[nodiscard]] auto get_indexed_documents_count(std::string index_name, const get_indexed_search_index_options& options = {}) const
129
+ -> std::future<std::pair<manager_error_context, std::uint64_t>>;
130
+
131
+ /**
132
+ * Pauses updates and maintenance for a scope-level index.
133
+ *
134
+ * @param index_name the name of the search index
135
+ * @param options optional parameters
136
+ * @param handler handler that implements @ref pause_ingest_search_index_handler
137
+ *
138
+ * @since 1.0.0
139
+ * @volatile
140
+ */
141
+ void pause_ingest(std::string index_name,
142
+ const pause_ingest_search_index_options& options,
143
+ pause_ingest_search_index_handler&& handler) const;
144
+
145
+ [[nodiscard]] auto pause_ingest(std::string index_name, const pause_ingest_search_index_options& options = {}) const
146
+ -> std::future<manager_error_context>;
147
+
148
+ /**
149
+ * Resumes updates and maintenance for a scope-level index.
150
+ *
151
+ * @param index_name the name of the search index
152
+ * @param options optional parameters
153
+ * @param handler handler that implements @ref resume_ingest_search_index_handler
154
+ *
155
+ * @since 1.0.0
156
+ * @volatile
157
+ */
158
+ void resume_ingest(std::string index_name,
159
+ const resume_ingest_search_index_options& options,
160
+ resume_ingest_search_index_handler&& handler) const;
161
+
162
+ [[nodiscard]] auto resume_ingest(std::string index_name, const resume_ingest_search_index_options& options = {}) const
163
+ -> std::future<manager_error_context>;
164
+
165
+ /**
166
+ * Allows querying against a scope-level index
167
+ *
168
+ * @param index_name the name of the search index
169
+ * @param options optional parameters
170
+ * @param handler handler that implements @ref allow_querying_search_index_handler
171
+ *
172
+ * @since 1.0.0
173
+ * @volatile
174
+ */
175
+ void allow_querying(std::string index_name,
176
+ const allow_querying_search_index_options& options,
177
+ allow_querying_search_index_handler&& handler) const;
178
+
179
+ [[nodiscard]] auto allow_querying(std::string index_name, const allow_querying_search_index_options& options = {}) const
180
+ -> std::future<manager_error_context>;
181
+
182
+ /**
183
+ * Disallows querying against a scope-level index
184
+ *
185
+ * @param index_name the name of the search index
186
+ * @param options optional parameters
187
+ * @param handler handler that implements @ref disallow_querying_search_index_handler
188
+ *
189
+ * @since 1.0.0
190
+ * @volatile
191
+ */
192
+ void disallow_querying(std::string index_name,
193
+ const disallow_querying_search_index_options& options,
194
+ disallow_querying_search_index_handler&& handler) const;
195
+
196
+ [[nodiscard]] auto disallow_querying(std::string index_name, const disallow_querying_search_index_options& options = {}) const
197
+ -> std::future<manager_error_context>;
198
+
199
+ /**
200
+ * Freeze the assignment of scope-level index partitions to nodes.
201
+ *
202
+ * @param index_name the name of the search index
203
+ * @param options optional parameters
204
+ * @param handler handler that implements @ref freeze_plan_search_index_handler
205
+ *
206
+ * @since 1.0.0
207
+ * @volatile
208
+ */
209
+ void freeze_plan(std::string index_name,
210
+ const freeze_plan_search_index_options& options,
211
+ freeze_plan_search_index_handler&& handler) const;
212
+
213
+ [[nodiscard]] auto freeze_plan(std::string index_name, const freeze_plan_search_index_options& options = {}) const
214
+ -> std::future<manager_error_context>;
215
+
216
+ /**
217
+ * Unfreeze the assignment of scope-level index partitions to nodes.
218
+ *
219
+ * @param index_name the name of the search index
220
+ * @param options optional parameters
221
+ * @param handler handler that implements @ref unfreeze_plan_search_index_handler
222
+ *
223
+ * @since 1.0.0
224
+ * @volatile
225
+ */
226
+ void unfreeze_plan(std::string index_name,
227
+ const unfreeze_plan_search_index_options& options,
228
+ unfreeze_plan_search_index_handler&& handler) const;
229
+
230
+ [[nodiscard]] auto unfreeze_plan(std::string index_name, const unfreeze_plan_search_index_options& options = {}) const
231
+ -> std::future<manager_error_context>;
232
+
233
+ /**
234
+ * Allows to see how a document is analyzed against a specific scope-level index.
235
+ *
236
+ * @param index_name the name of the search index
237
+ * @param document the document to be analyzed
238
+ * @param options optional parameters
239
+ * @param handler handler that implements @ref analyze_document_handler
240
+ *
241
+ * @since 1.0.0
242
+ * @volatile
243
+ */
244
+ template<typename Document>
245
+ void analyze_document(std::string index_name,
246
+ Document document,
247
+ const analyze_document_options& options,
248
+ analyze_document_handler&& handler) const
249
+ {
250
+ auto encoded = couchbase::codec::default_json_transcoder::encode(document); // Encode as JSON and convert to string
251
+ auto decoded = std::string{ reinterpret_cast<const char*>(encoded.data.data()), encoded.data.size() };
252
+ return analyze_document(std::move(index_name), decoded, options, std::move(handler));
253
+ }
254
+
255
+ template<typename Document>
256
+ [[nodiscard]] auto analyze_document(std::string index_name, Document document, const analyze_document_options& options = {}) const
257
+ -> std::future<std::pair<manager_error_context, std::vector<std::string>>>
258
+ {
259
+ auto encoded = couchbase::codec::default_json_transcoder::encode(document); // Encode as JSON and convert to string
260
+ auto decoded = std::string{ reinterpret_cast<const char*>(encoded.data.data()), encoded.data.size() };
261
+
262
+ return analyze_document(std::move(index_name), decoded, options);
263
+ }
264
+
265
+ /**
266
+ * Allows to see how a document is analyzed against a specific scope-level index.
267
+ *
268
+ * @param index_name the name of the search index
269
+ * @param document the document to be analyzed encoded in JSON
270
+ * @param options optional parameters
271
+ * @param handler handler that implements @ref analyze_document_handler
272
+ *
273
+ * @since 1.0.0
274
+ * @volatile
275
+ */
276
+ void analyze_document(std::string index_name,
277
+ std::string document,
278
+ const analyze_document_options& options,
279
+ analyze_document_handler&& handler) const;
280
+
281
+ [[nodiscard]] auto analyze_document(std::string index_name, std::string document, const analyze_document_options& options) const
282
+ -> std::future<std::pair<manager_error_context, std::vector<std::string>>>;
283
+
284
+ private:
285
+ friend class scope;
286
+
287
+ explicit scope_search_index_manager(core::cluster core, std::string bucket_name, std::string scope_name);
288
+
289
+ std::shared_ptr<search_index_manager_impl> impl_;
290
+ };
291
+ } // namespace couchbase
@@ -0,0 +1,120 @@
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
+ #include <couchbase/vector_search.hxx>
22
+
23
+ #ifndef COUCHBASE_CXX_CLIENT_DOXYGEN
24
+ namespace couchbase
25
+ {
26
+ namespace core
27
+ {
28
+ class cluster;
29
+ } // namespace core
30
+ class search_request_impl;
31
+ } // namespace couchbase
32
+ #endif
33
+
34
+ namespace couchbase
35
+ {
36
+ /**
37
+ * A search_request is used to perform operations against the Full Text Search (FTS) Couchbase service.
38
+ *
39
+ * It can be used to send an FTS @ref search_query, and/or a @ref vector_search
40
+ *
41
+ * @since 1.0.0
42
+ * @volatile
43
+ */
44
+ class search_request
45
+ {
46
+ public:
47
+ /**
48
+ * Create a new search_request with a @ref search_query
49
+ *
50
+ * @param search_query the query to run
51
+ *
52
+ * @since 1.0.0
53
+ * @volatile
54
+ */
55
+ explicit search_request(const couchbase::search_query& search_query);
56
+
57
+ /**
58
+ * Create a new search_request with a @ref vector_search
59
+ *
60
+ * @param vector_search the vector_search to run
61
+ *
62
+ * @since 1.0.0
63
+ * @volatile
64
+ */
65
+ explicit search_request(const couchbase::vector_search& vector_search);
66
+
67
+ /**
68
+ * Used to run a @ref search_query together with an existing @ref vector_search.
69
+ * Note that a maximum of one SearchQuery and one VectorSearch can be provided.
70
+ *
71
+ * @param search_query the search_query to run with an existing vector_search.
72
+ *
73
+ * @return this search_request for chaining purposes.
74
+ *
75
+ * @since 1.0.0
76
+ * @volatile
77
+ */
78
+ auto search_query(const couchbase::search_query& search_query) -> search_request&;
79
+
80
+ /**
81
+ * Used to run a @ref vector_query together with an existing @ref search_query.
82
+ * Note that a maximum of one SearchQuery and one VectorSearch can be provided.
83
+ *
84
+ * @param vector_search the vector_search to be run with an existing search_query.
85
+ *
86
+ * @return this search_request for chaining purposes.
87
+ *
88
+ * @since 1.0.0
89
+ * @volatile
90
+ */
91
+ auto vector_search(const couchbase::vector_search& vector_search) -> search_request&;
92
+
93
+ /**
94
+ * @return encoded representation of the query.
95
+ *
96
+ * @since 1.0.0
97
+ * @internal
98
+ */
99
+ [[nodiscard]] std::optional<encoded_search_query> search_query() const;
100
+
101
+ /**
102
+ * @return encoded representation of the vector search query.
103
+ *
104
+ * @since 1.0.0
105
+ * @internal
106
+ */
107
+ [[nodiscard]] std::optional<encoded_search_query> vector_search() const;
108
+
109
+ /**
110
+ * @return vector_search_options, if set
111
+ *
112
+ * @since 1.0.0
113
+ * @internal
114
+ */
115
+ [[nodiscard]] std::optional<vector_search_options::built> vector_options();
116
+
117
+ private:
118
+ std::shared_ptr<search_request_impl> impl_;
119
+ };
120
+ } // namespace couchbase
@@ -0,0 +1,58 @@
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
+ namespace couchbase
21
+ {
22
+ enum class service_type {
23
+ /**
24
+ * The Key-Value service (KV)
25
+ */
26
+ key_value,
27
+
28
+ /**
29
+ * The Query service (SQL++)
30
+ */
31
+ query,
32
+
33
+ /**
34
+ * The Analytics service
35
+ */
36
+ analytics,
37
+
38
+ /**
39
+ * The Search service (FTS)
40
+ */
41
+ search,
42
+
43
+ /**
44
+ * The View service
45
+ */
46
+ view,
47
+
48
+ /**
49
+ * The Cluster Manager service (ns_server)
50
+ */
51
+ management,
52
+
53
+ /**
54
+ * The Eventing service
55
+ */
56
+ eventing,
57
+ };
58
+ } // namespace couchbase
@@ -17,26 +17,55 @@
17
17
 
18
18
  #pragma once
19
19
 
20
- #include <functional>
20
+ #include <couchbase/common_options.hxx>
21
+ #include <couchbase/manager_error_context.hxx>
22
+
23
+ #include <cstdint>
21
24
  #include <memory>
22
25
  #include <optional>
23
- #include <string>
24
26
 
25
27
  namespace couchbase
26
28
  {
27
29
  struct update_collection_options : public common_options<update_collection_options> {
28
30
  public:
31
+ /**
32
+ * Immutable value object representing consistent options.
33
+ *
34
+ * @since 1.0.0
35
+ * @internal
36
+ */
29
37
  struct built : public common_options<update_collection_options>::built {
30
38
  };
31
39
 
40
+ /**
41
+ * Validates the options and returns them as an immutable value.
42
+ *
43
+ * @return consistent options as an immutable value
44
+ *
45
+ * @exception std::system_error with code errc::common::invalid_argument if the options are not valid
46
+ *
47
+ * @since 1.0.0
48
+ * @internal
49
+ */
32
50
  [[nodiscard]] auto build() const -> built
33
51
  {
34
52
  return { build_common_options() };
35
53
  }
36
54
  };
37
55
 
56
+ /**
57
+ * The settings that should be updated for the collection
58
+ */
38
59
  struct update_collection_settings {
39
- std::optional<std::uint32_t> max_expiry{};
60
+ /**
61
+ * The maximum expiry, in seconds, for documents in this collection. Values greater than or equal to -1 are valid.
62
+ * Value of 0 sets max_expiry to the bucket-level setting and value of -1 to set it as no-expiry.
63
+ */
64
+ std::optional<std::int32_t> max_expiry{};
65
+
66
+ /**
67
+ * Whether history retention should be enabled.
68
+ */
40
69
  std::optional<bool> history{};
41
70
  };
42
71