couchbase 4.2.9 → 4.2.11-rc.1
Sign up to get free protection for your applications and to get access to all the features.
- package/deps/couchbase-cxx-client/CMakeLists.txt +4 -0
- package/deps/couchbase-cxx-client/cmake/CompilerWarnings.cmake +7 -3
- package/deps/couchbase-cxx-client/cmake/OpenSSL.cmake +1 -0
- package/deps/couchbase-cxx-client/core/bucket.cxx +67 -2
- package/deps/couchbase-cxx-client/core/bucket.hxx +2 -1
- package/deps/couchbase-cxx-client/core/cluster.cxx +65 -1
- package/deps/couchbase-cxx-client/core/impl/bucket.cxx +24 -0
- package/deps/couchbase-cxx-client/core/impl/cluster.cxx +73 -0
- package/deps/couchbase-cxx-client/core/impl/collection.cxx +2 -2
- package/deps/couchbase-cxx-client/core/impl/diagnostics.cxx +294 -0
- package/deps/couchbase-cxx-client/core/impl/diagnostics.hxx +39 -0
- package/deps/couchbase-cxx-client/core/impl/query_index_manager.cxx +6 -6
- package/deps/couchbase-cxx-client/core/impl/scope.cxx +19 -4
- package/deps/couchbase-cxx-client/core/impl/search.cxx +75 -2
- package/deps/couchbase-cxx-client/core/impl/search.hxx +8 -0
- package/deps/couchbase-cxx-client/core/impl/search_index_manager.cxx +261 -18
- package/deps/couchbase-cxx-client/core/impl/search_request.cxx +139 -0
- package/deps/couchbase-cxx-client/core/impl/vector_query.cxx +42 -0
- package/deps/couchbase-cxx-client/core/impl/vector_search.cxx +40 -0
- package/deps/couchbase-cxx-client/core/io/http_session.hxx +6 -3
- package/deps/couchbase-cxx-client/core/io/http_session_manager.hxx +7 -1
- package/deps/couchbase-cxx-client/core/io/mcbp_command.hxx +10 -0
- package/deps/couchbase-cxx-client/core/io/mcbp_session.cxx +48 -33
- package/deps/couchbase-cxx-client/core/io/mcbp_session.hxx +2 -0
- package/deps/couchbase-cxx-client/core/logger/logger.cxx +1 -1
- package/deps/couchbase-cxx-client/core/management/design_document.hxx +1 -1
- package/deps/couchbase-cxx-client/core/meta/features.hxx +26 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_all_replicas.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_lookup_in_any_replica.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/document_query.cxx +8 -3
- package/deps/couchbase-cxx-client/core/operations/document_search.cxx +37 -1
- package/deps/couchbase-cxx-client/core/operations/document_search.hxx +11 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/document_view.hxx +1 -0
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.cxx +7 -6
- package/deps/couchbase-cxx-client/core/operations/management/collection_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.cxx +7 -8
- package/deps/couchbase-cxx-client/core/operations/management/collection_update.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/error_utils.cxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.cxx +24 -13
- package/deps/couchbase-cxx-client/core/operations/management/query_index_create.hxx +1 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_analyze_document.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_ingest.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_plan_freeze.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.cxx +21 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_control_query.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_drop.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get.hxx +2 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.cxx +39 -22
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_all.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.cxx +18 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_get_documents_count.hxx +3 -0
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.cxx +17 -1
- package/deps/couchbase-cxx-client/core/operations/management/search_index_upsert.hxx +3 -0
- package/deps/couchbase-cxx-client/core/origin.cxx +14 -0
- package/deps/couchbase-cxx-client/core/origin.hxx +6 -0
- package/deps/couchbase-cxx-client/core/protocol/status.cxx +2 -0
- package/deps/couchbase-cxx-client/core/protocol/status.hxx +1 -0
- package/deps/couchbase-cxx-client/core/topology/capabilities.hxx +70 -1
- package/deps/couchbase-cxx-client/core/topology/capabilities_fmt.hxx +30 -2
- package/deps/couchbase-cxx-client/core/topology/collections_manifest.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/collections_manifest_json.hxx +1 -1
- package/deps/couchbase-cxx-client/core/topology/configuration.hxx +1 -34
- package/deps/couchbase-cxx-client/core/topology/configuration_fmt.hxx +2 -2
- package/deps/couchbase-cxx-client/core/topology/configuration_json.hxx +43 -20
- package/deps/couchbase-cxx-client/core/transactions/internal/exceptions_internal.hxx +5 -0
- package/deps/couchbase-cxx-client/core/transactions/internal/utils.hxx +4 -0
- package/deps/couchbase-cxx-client/core/vector_query_combination.hxx +23 -0
- package/deps/couchbase-cxx-client/couchbase/bucket.hxx +29 -0
- package/deps/couchbase-cxx-client/couchbase/cluster.hxx +110 -0
- package/deps/couchbase-cxx-client/couchbase/codec/json_transcoder.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_binary_transcoder.hxx +2 -1
- package/deps/couchbase-cxx-client/couchbase/codec/raw_json_transcoder.hxx +78 -0
- package/deps/couchbase-cxx-client/couchbase/codec/raw_string_transcoder.hxx +72 -0
- package/deps/couchbase-cxx-client/couchbase/collection_query_index_manager.hxx +80 -11
- package/deps/couchbase-cxx-client/couchbase/create_collection_options.hxx +29 -1
- package/deps/couchbase-cxx-client/couchbase/diagnostics_options.hxx +75 -0
- package/deps/couchbase-cxx-client/couchbase/diagnostics_result.hxx +124 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_diagnostics.hxx +206 -0
- package/deps/couchbase-cxx-client/couchbase/endpoint_ping_report.hxx +205 -0
- package/deps/couchbase-cxx-client/couchbase/fmt/key_value_status_code.hxx +3 -1
- package/deps/couchbase-cxx-client/couchbase/get_options.hxx +1 -6
- package/deps/couchbase-cxx-client/couchbase/key_value_status_code.hxx +1 -0
- package/deps/couchbase-cxx-client/couchbase/management/collection_spec.hxx +1 -1
- package/deps/couchbase-cxx-client/couchbase/ping_options.hxx +93 -0
- package/deps/couchbase-cxx-client/couchbase/ping_result.hxx +118 -0
- package/deps/couchbase-cxx-client/couchbase/query_index_manager.hxx +6 -8
- package/deps/couchbase-cxx-client/couchbase/scope.hxx +24 -8
- package/deps/couchbase-cxx-client/couchbase/scope_search_index_manager.hxx +291 -0
- package/deps/couchbase-cxx-client/couchbase/search_request.hxx +120 -0
- package/deps/couchbase-cxx-client/couchbase/service_type.hxx +58 -0
- package/deps/couchbase-cxx-client/couchbase/update_collection_options.hxx +32 -3
- package/deps/couchbase-cxx-client/couchbase/vector_query.hxx +99 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search.hxx +85 -0
- package/deps/couchbase-cxx-client/couchbase/vector_search_options.hxx +76 -0
- package/dist/binding.d.ts +33 -2
- package/dist/binding.js +4 -1
- package/dist/bindingutilities.d.ts +16 -3
- package/dist/bindingutilities.js +47 -7
- package/dist/cluster.d.ts +12 -1
- package/dist/cluster.js +22 -0
- package/dist/couchbase.d.ts +2 -0
- package/dist/couchbase.js +2 -0
- package/dist/queryindexmanager.d.ts +4 -4
- package/dist/queryindexmanager.js +7 -7
- package/dist/scope.d.ts +21 -0
- package/dist/scope.js +34 -0
- package/dist/scopesearchindexmanager.d.ts +116 -0
- package/dist/scopesearchindexmanager.js +406 -0
- package/dist/sdspecs.js +10 -9
- package/dist/sdutils.d.ts +1 -0
- package/dist/sdutils.js +4 -0
- package/dist/searchexecutor.d.ts +5 -3
- package/dist/searchexecutor.js +27 -4
- package/dist/searchindexmanager.d.ts +58 -3
- package/dist/searchindexmanager.js +188 -104
- package/dist/searchtypes.d.ts +46 -0
- package/dist/searchtypes.js +81 -1
- package/dist/vectorsearch.d.ts +99 -0
- package/dist/vectorsearch.js +132 -0
- package/dist/viewexecutor.js +13 -9
- package/dist/viewindexmanager.d.ts +70 -7
- package/dist/viewindexmanager.js +236 -103
- package/dist/viewtypes.d.ts +26 -0
- package/dist/viewtypes.js +17 -1
- package/package.json +7 -7
- package/src/constants.cpp +12 -0
- package/src/jstocbpp_autogen.hpp +113 -13
- package/tools/gen-bindings-json.py +2 -0
package/dist/scope.js
CHANGED
@@ -4,6 +4,8 @@ exports.Scope = void 0;
|
|
4
4
|
const analyticsexecutor_1 = require("./analyticsexecutor");
|
5
5
|
const collection_1 = require("./collection");
|
6
6
|
const queryexecutor_1 = require("./queryexecutor");
|
7
|
+
const searchexecutor_1 = require("./searchexecutor");
|
8
|
+
const scopesearchindexmanager_1 = require("./scopesearchindexmanager");
|
7
9
|
const utilities_1 = require("./utilities");
|
8
10
|
/**
|
9
11
|
* Exposes the operations which are available to be performed against a scope.
|
@@ -64,6 +66,16 @@ class Scope {
|
|
64
66
|
collection(collectionName) {
|
65
67
|
return new collection_1.Collection(this, collectionName);
|
66
68
|
}
|
69
|
+
/**
|
70
|
+
* Returns a SearchIndexManager which can be used to manage the search
|
71
|
+
* indexes of this scope.
|
72
|
+
*
|
73
|
+
* Volatile: This API is subject to change at any time.
|
74
|
+
*
|
75
|
+
*/
|
76
|
+
searchIndexes() {
|
77
|
+
return new scopesearchindexmanager_1.ScopeSearchIndexManager(this.cluster, this.bucket.name, this._name);
|
78
|
+
}
|
67
79
|
/**
|
68
80
|
* Executes a N1QL query against the cluster scoped to this scope.
|
69
81
|
*
|
@@ -110,5 +122,27 @@ class Scope {
|
|
110
122
|
queryContext: `${bucket.name}.${this.name}`,
|
111
123
|
}), callback);
|
112
124
|
}
|
125
|
+
/**
|
126
|
+
* Executes a search query against the scope.
|
127
|
+
*
|
128
|
+
* Volatile: This API is subject to change at any time.
|
129
|
+
*
|
130
|
+
* @param indexName The name of the index to query.
|
131
|
+
* @param request The SearchRequest describing the search to execute.
|
132
|
+
* @param options Optional parameters for this operation.
|
133
|
+
* @param callback A node-style callback to be invoked after execution.
|
134
|
+
*/
|
135
|
+
search(indexName, request, options, callback) {
|
136
|
+
if (options instanceof Function) {
|
137
|
+
callback = arguments[2];
|
138
|
+
options = undefined;
|
139
|
+
}
|
140
|
+
if (!options) {
|
141
|
+
options = {};
|
142
|
+
}
|
143
|
+
const exec = new searchexecutor_1.SearchExecutor(this.cluster, this._bucket.name, this._name);
|
144
|
+
const options_ = options;
|
145
|
+
return utilities_1.PromiseHelper.wrapAsync(() => exec.query(indexName, request, options_), callback);
|
146
|
+
}
|
113
147
|
}
|
114
148
|
exports.Scope = Scope;
|
@@ -0,0 +1,116 @@
|
|
1
|
+
import { Cluster } from './cluster';
|
2
|
+
import { NodeCallback } from './utilities';
|
3
|
+
import { GetSearchIndexOptions, GetAllSearchIndexesOptions, UpsertSearchIndexOptions, GetSearchIndexedDocumentsCountOptions, DropSearchIndexOptions, PauseSearchIngestOptions, ResumeSearchIngestOptions, AllowSearchQueryingOptions, DisallowSearchQueryingOptions, FreezeSearchPlanOptions, UnfreezeSearchPlanOptions, AnalyzeSearchDocumentOptions, ISearchIndex, SearchIndex } from './searchindexmanager';
|
4
|
+
/**
|
5
|
+
* SearchIndexManager provides an interface for managing the
|
6
|
+
* search indexes on the cluster.
|
7
|
+
*
|
8
|
+
* Volatile: This API is subject to change at any time.
|
9
|
+
*
|
10
|
+
* @category Management
|
11
|
+
*/
|
12
|
+
export declare class ScopeSearchIndexManager {
|
13
|
+
private _cluster;
|
14
|
+
private _bucketName;
|
15
|
+
private _scopeName;
|
16
|
+
/**
|
17
|
+
* @internal
|
18
|
+
*/
|
19
|
+
constructor(cluster: Cluster, bucketName: string, scopeName: string);
|
20
|
+
/**
|
21
|
+
* Returns an index by it's name.
|
22
|
+
*
|
23
|
+
* @param indexName The index to retrieve.
|
24
|
+
* @param options Optional parameters for this operation.
|
25
|
+
* @param callback A node-style callback to be invoked after execution.
|
26
|
+
*/
|
27
|
+
getIndex(indexName: string, options?: GetSearchIndexOptions, callback?: NodeCallback<SearchIndex>): Promise<SearchIndex>;
|
28
|
+
/**
|
29
|
+
* Returns a list of all existing indexes.
|
30
|
+
*
|
31
|
+
* @param options Optional parameters for this operation.
|
32
|
+
* @param callback A node-style callback to be invoked after execution.
|
33
|
+
*/
|
34
|
+
getAllIndexes(options?: GetAllSearchIndexesOptions, callback?: NodeCallback<SearchIndex[]>): Promise<SearchIndex[]>;
|
35
|
+
/**
|
36
|
+
* Creates or updates an existing index.
|
37
|
+
*
|
38
|
+
* @param indexDefinition The index to update.
|
39
|
+
* @param options Optional parameters for this operation.
|
40
|
+
* @param callback A node-style callback to be invoked after execution.
|
41
|
+
*/
|
42
|
+
upsertIndex(indexDefinition: ISearchIndex, options?: UpsertSearchIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
43
|
+
/**
|
44
|
+
* Drops an index.
|
45
|
+
*
|
46
|
+
* @param indexName The name of the index to drop.
|
47
|
+
* @param options Optional parameters for this operation.
|
48
|
+
* @param callback A node-style callback to be invoked after execution.
|
49
|
+
*/
|
50
|
+
dropIndex(indexName: string, options?: DropSearchIndexOptions, callback?: NodeCallback<void>): Promise<void>;
|
51
|
+
/**
|
52
|
+
* Returns the number of documents that have been indexed.
|
53
|
+
*
|
54
|
+
* @param indexName The name of the index to return the count for.
|
55
|
+
* @param options Optional parameters for this operation.
|
56
|
+
* @param callback A node-style callback to be invoked after execution.
|
57
|
+
*/
|
58
|
+
getIndexedDocumentsCount(indexName: string, options?: GetSearchIndexedDocumentsCountOptions, callback?: NodeCallback<number>): Promise<number>;
|
59
|
+
/**
|
60
|
+
* Pauses the ingestion of documents into an index.
|
61
|
+
*
|
62
|
+
* @param indexName The name of the index to pause.
|
63
|
+
* @param options Optional parameters for this operation.
|
64
|
+
* @param callback A node-style callback to be invoked after execution.
|
65
|
+
*/
|
66
|
+
pauseIngest(indexName: string, options?: PauseSearchIngestOptions, callback?: NodeCallback<void>): Promise<void>;
|
67
|
+
/**
|
68
|
+
* Resumes the ingestion of documents into an index.
|
69
|
+
*
|
70
|
+
* @param indexName The name of the index to resume.
|
71
|
+
* @param options Optional parameters for this operation.
|
72
|
+
* @param callback A node-style callback to be invoked after execution.
|
73
|
+
*/
|
74
|
+
resumeIngest(indexName: string, options?: ResumeSearchIngestOptions, callback?: NodeCallback<void>): Promise<void>;
|
75
|
+
/**
|
76
|
+
* Enables querying of an index.
|
77
|
+
*
|
78
|
+
* @param indexName The name of the index to enable querying for.
|
79
|
+
* @param options Optional parameters for this operation.
|
80
|
+
* @param callback A node-style callback to be invoked after execution.
|
81
|
+
*/
|
82
|
+
allowQuerying(indexName: string, options?: AllowSearchQueryingOptions, callback?: NodeCallback<void>): Promise<void>;
|
83
|
+
/**
|
84
|
+
* Disables querying of an index.
|
85
|
+
*
|
86
|
+
* @param indexName The name of the index to disable querying for.
|
87
|
+
* @param options Optional parameters for this operation.
|
88
|
+
* @param callback A node-style callback to be invoked after execution.
|
89
|
+
*/
|
90
|
+
disallowQuerying(indexName: string, options?: DisallowSearchQueryingOptions, callback?: NodeCallback<void>): Promise<void>;
|
91
|
+
/**
|
92
|
+
* Freezes the indexing plan for execution of queries.
|
93
|
+
*
|
94
|
+
* @param indexName The name of the index to freeze the plan of.
|
95
|
+
* @param options Optional parameters for this operation.
|
96
|
+
* @param callback A node-style callback to be invoked after execution.
|
97
|
+
*/
|
98
|
+
freezePlan(indexName: string, options?: FreezeSearchPlanOptions, callback?: NodeCallback<void>): Promise<void>;
|
99
|
+
/**
|
100
|
+
* Unfreezes the indexing plan for execution of queries.
|
101
|
+
*
|
102
|
+
* @param indexName The name of the index to freeze the plan of.
|
103
|
+
* @param options Optional parameters for this operation.
|
104
|
+
* @param callback A node-style callback to be invoked after execution.
|
105
|
+
*/
|
106
|
+
unfreezePlan(indexName: string, options?: UnfreezeSearchPlanOptions, callback?: NodeCallback<void>): Promise<void>;
|
107
|
+
/**
|
108
|
+
* Performs analysis of a specific document by an index.
|
109
|
+
*
|
110
|
+
* @param indexName The name of the index to use for the analysis.
|
111
|
+
* @param document The document to analyze.
|
112
|
+
* @param options Optional parameters for this operation.
|
113
|
+
* @param callback A node-style callback to be invoked after execution.
|
114
|
+
*/
|
115
|
+
analyzeDocument(indexName: string, document: any, options?: AnalyzeSearchDocumentOptions, callback?: NodeCallback<any>): Promise<any>;
|
116
|
+
}
|
@@ -0,0 +1,406 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.ScopeSearchIndexManager = void 0;
|
4
|
+
const utilities_1 = require("./utilities");
|
5
|
+
const bindingutilities_1 = require("./bindingutilities");
|
6
|
+
const searchindexmanager_1 = require("./searchindexmanager");
|
7
|
+
/**
|
8
|
+
* SearchIndexManager provides an interface for managing the
|
9
|
+
* search indexes on the cluster.
|
10
|
+
*
|
11
|
+
* Volatile: This API is subject to change at any time.
|
12
|
+
*
|
13
|
+
* @category Management
|
14
|
+
*/
|
15
|
+
class ScopeSearchIndexManager {
|
16
|
+
/**
|
17
|
+
* @internal
|
18
|
+
*/
|
19
|
+
constructor(cluster, bucketName, scopeName) {
|
20
|
+
this._cluster = cluster;
|
21
|
+
this._bucketName = bucketName;
|
22
|
+
this._scopeName = scopeName;
|
23
|
+
}
|
24
|
+
/**
|
25
|
+
* Returns an index by it's name.
|
26
|
+
*
|
27
|
+
* @param indexName The index to retrieve.
|
28
|
+
* @param options Optional parameters for this operation.
|
29
|
+
* @param callback A node-style callback to be invoked after execution.
|
30
|
+
*/
|
31
|
+
async getIndex(indexName, options, callback) {
|
32
|
+
if (options instanceof Function) {
|
33
|
+
callback = arguments[1];
|
34
|
+
options = undefined;
|
35
|
+
}
|
36
|
+
if (!options) {
|
37
|
+
options = {};
|
38
|
+
}
|
39
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
40
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
41
|
+
this._cluster.conn.managementSearchIndexGet({
|
42
|
+
index_name: indexName,
|
43
|
+
timeout: timeout,
|
44
|
+
bucket_name: this._bucketName,
|
45
|
+
scope_name: this._scopeName,
|
46
|
+
}, (cppErr, resp) => {
|
47
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
48
|
+
if (err) {
|
49
|
+
return wrapCallback(err, null);
|
50
|
+
}
|
51
|
+
const index = searchindexmanager_1.SearchIndex._fromCppData(resp.index);
|
52
|
+
wrapCallback(null, index);
|
53
|
+
});
|
54
|
+
}, callback);
|
55
|
+
}
|
56
|
+
/**
|
57
|
+
* Returns a list of all existing indexes.
|
58
|
+
*
|
59
|
+
* @param options Optional parameters for this operation.
|
60
|
+
* @param callback A node-style callback to be invoked after execution.
|
61
|
+
*/
|
62
|
+
async getAllIndexes(options, callback) {
|
63
|
+
if (options instanceof Function) {
|
64
|
+
callback = arguments[0];
|
65
|
+
options = undefined;
|
66
|
+
}
|
67
|
+
if (!options) {
|
68
|
+
options = {};
|
69
|
+
}
|
70
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
71
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
72
|
+
this._cluster.conn.managementSearchIndexGetAll({
|
73
|
+
timeout: timeout,
|
74
|
+
bucket_name: this._bucketName,
|
75
|
+
scope_name: this._scopeName,
|
76
|
+
}, (cppErr, resp) => {
|
77
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
78
|
+
if (err) {
|
79
|
+
return wrapCallback(err, null);
|
80
|
+
}
|
81
|
+
const indexes = resp.indexes.map((indexData) => searchindexmanager_1.SearchIndex._fromCppData(indexData));
|
82
|
+
wrapCallback(null, indexes);
|
83
|
+
});
|
84
|
+
}, callback);
|
85
|
+
}
|
86
|
+
/**
|
87
|
+
* Creates or updates an existing index.
|
88
|
+
*
|
89
|
+
* @param indexDefinition The index to update.
|
90
|
+
* @param options Optional parameters for this operation.
|
91
|
+
* @param callback A node-style callback to be invoked after execution.
|
92
|
+
*/
|
93
|
+
async upsertIndex(indexDefinition, options, callback) {
|
94
|
+
if (options instanceof Function) {
|
95
|
+
callback = arguments[1];
|
96
|
+
options = undefined;
|
97
|
+
}
|
98
|
+
if (!options) {
|
99
|
+
options = {};
|
100
|
+
}
|
101
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
102
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
103
|
+
this._cluster.conn.managementSearchIndexUpsert({
|
104
|
+
index: searchindexmanager_1.SearchIndex._toCppData(indexDefinition),
|
105
|
+
timeout: timeout,
|
106
|
+
bucket_name: this._bucketName,
|
107
|
+
scope_name: this._scopeName,
|
108
|
+
}, (cppErr) => {
|
109
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
110
|
+
if (err) {
|
111
|
+
return wrapCallback(err, null);
|
112
|
+
}
|
113
|
+
wrapCallback(err);
|
114
|
+
});
|
115
|
+
}, callback);
|
116
|
+
}
|
117
|
+
/**
|
118
|
+
* Drops an index.
|
119
|
+
*
|
120
|
+
* @param indexName The name of the index to drop.
|
121
|
+
* @param options Optional parameters for this operation.
|
122
|
+
* @param callback A node-style callback to be invoked after execution.
|
123
|
+
*/
|
124
|
+
async dropIndex(indexName, options, callback) {
|
125
|
+
if (options instanceof Function) {
|
126
|
+
callback = arguments[1];
|
127
|
+
options = undefined;
|
128
|
+
}
|
129
|
+
if (!options) {
|
130
|
+
options = {};
|
131
|
+
}
|
132
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
133
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
134
|
+
this._cluster.conn.managementSearchIndexDrop({
|
135
|
+
index_name: indexName,
|
136
|
+
timeout: timeout,
|
137
|
+
bucket_name: this._bucketName,
|
138
|
+
scope_name: this._scopeName,
|
139
|
+
}, (cppErr) => {
|
140
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
141
|
+
if (err) {
|
142
|
+
return wrapCallback(err, null);
|
143
|
+
}
|
144
|
+
wrapCallback(err);
|
145
|
+
});
|
146
|
+
}, callback);
|
147
|
+
}
|
148
|
+
/**
|
149
|
+
* Returns the number of documents that have been indexed.
|
150
|
+
*
|
151
|
+
* @param indexName The name of the index to return the count for.
|
152
|
+
* @param options Optional parameters for this operation.
|
153
|
+
* @param callback A node-style callback to be invoked after execution.
|
154
|
+
*/
|
155
|
+
async getIndexedDocumentsCount(indexName, options, callback) {
|
156
|
+
if (options instanceof Function) {
|
157
|
+
callback = arguments[1];
|
158
|
+
options = undefined;
|
159
|
+
}
|
160
|
+
if (!options) {
|
161
|
+
options = {};
|
162
|
+
}
|
163
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
164
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
165
|
+
this._cluster.conn.managementSearchIndexGetDocumentsCount({
|
166
|
+
index_name: indexName,
|
167
|
+
timeout: timeout,
|
168
|
+
bucket_name: this._bucketName,
|
169
|
+
scope_name: this._scopeName,
|
170
|
+
}, (cppErr, resp) => {
|
171
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
172
|
+
if (err) {
|
173
|
+
return wrapCallback(err, null);
|
174
|
+
}
|
175
|
+
wrapCallback(null, resp.count);
|
176
|
+
});
|
177
|
+
}, callback);
|
178
|
+
}
|
179
|
+
/**
|
180
|
+
* Pauses the ingestion of documents into an index.
|
181
|
+
*
|
182
|
+
* @param indexName The name of the index to pause.
|
183
|
+
* @param options Optional parameters for this operation.
|
184
|
+
* @param callback A node-style callback to be invoked after execution.
|
185
|
+
*/
|
186
|
+
async pauseIngest(indexName, options, callback) {
|
187
|
+
if (options instanceof Function) {
|
188
|
+
callback = arguments[1];
|
189
|
+
options = undefined;
|
190
|
+
}
|
191
|
+
if (!options) {
|
192
|
+
options = {};
|
193
|
+
}
|
194
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
195
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
196
|
+
this._cluster.conn.managementSearchIndexControlIngest({
|
197
|
+
index_name: indexName,
|
198
|
+
pause: true,
|
199
|
+
timeout: timeout,
|
200
|
+
bucket_name: this._bucketName,
|
201
|
+
scope_name: this._scopeName,
|
202
|
+
}, (cppErr) => {
|
203
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
204
|
+
if (err) {
|
205
|
+
return wrapCallback(err, null);
|
206
|
+
}
|
207
|
+
wrapCallback(err);
|
208
|
+
});
|
209
|
+
}, callback);
|
210
|
+
}
|
211
|
+
/**
|
212
|
+
* Resumes the ingestion of documents into an index.
|
213
|
+
*
|
214
|
+
* @param indexName The name of the index to resume.
|
215
|
+
* @param options Optional parameters for this operation.
|
216
|
+
* @param callback A node-style callback to be invoked after execution.
|
217
|
+
*/
|
218
|
+
async resumeIngest(indexName, options, callback) {
|
219
|
+
if (options instanceof Function) {
|
220
|
+
callback = arguments[1];
|
221
|
+
options = undefined;
|
222
|
+
}
|
223
|
+
if (!options) {
|
224
|
+
options = {};
|
225
|
+
}
|
226
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
227
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
228
|
+
this._cluster.conn.managementSearchIndexControlIngest({
|
229
|
+
index_name: indexName,
|
230
|
+
pause: false,
|
231
|
+
timeout: timeout,
|
232
|
+
bucket_name: this._bucketName,
|
233
|
+
scope_name: this._scopeName,
|
234
|
+
}, (cppErr) => {
|
235
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
236
|
+
if (err) {
|
237
|
+
return wrapCallback(err, null);
|
238
|
+
}
|
239
|
+
wrapCallback(err);
|
240
|
+
});
|
241
|
+
}, callback);
|
242
|
+
}
|
243
|
+
/**
|
244
|
+
* Enables querying of an index.
|
245
|
+
*
|
246
|
+
* @param indexName The name of the index to enable querying for.
|
247
|
+
* @param options Optional parameters for this operation.
|
248
|
+
* @param callback A node-style callback to be invoked after execution.
|
249
|
+
*/
|
250
|
+
async allowQuerying(indexName, options, callback) {
|
251
|
+
if (options instanceof Function) {
|
252
|
+
callback = arguments[1];
|
253
|
+
options = undefined;
|
254
|
+
}
|
255
|
+
if (!options) {
|
256
|
+
options = {};
|
257
|
+
}
|
258
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
259
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
260
|
+
this._cluster.conn.managementSearchIndexControlQuery({
|
261
|
+
index_name: indexName,
|
262
|
+
allow: true,
|
263
|
+
timeout: timeout,
|
264
|
+
bucket_name: this._bucketName,
|
265
|
+
scope_name: this._scopeName,
|
266
|
+
}, (cppErr) => {
|
267
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
268
|
+
if (err) {
|
269
|
+
return wrapCallback(err, null);
|
270
|
+
}
|
271
|
+
wrapCallback(err);
|
272
|
+
});
|
273
|
+
}, callback);
|
274
|
+
}
|
275
|
+
/**
|
276
|
+
* Disables querying of an index.
|
277
|
+
*
|
278
|
+
* @param indexName The name of the index to disable querying for.
|
279
|
+
* @param options Optional parameters for this operation.
|
280
|
+
* @param callback A node-style callback to be invoked after execution.
|
281
|
+
*/
|
282
|
+
async disallowQuerying(indexName, options, callback) {
|
283
|
+
if (options instanceof Function) {
|
284
|
+
callback = arguments[1];
|
285
|
+
options = undefined;
|
286
|
+
}
|
287
|
+
if (!options) {
|
288
|
+
options = {};
|
289
|
+
}
|
290
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
291
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
292
|
+
this._cluster.conn.managementSearchIndexControlQuery({
|
293
|
+
index_name: indexName,
|
294
|
+
allow: false,
|
295
|
+
timeout: timeout,
|
296
|
+
bucket_name: this._bucketName,
|
297
|
+
scope_name: this._scopeName,
|
298
|
+
}, (cppErr) => {
|
299
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
300
|
+
if (err) {
|
301
|
+
return wrapCallback(err, null);
|
302
|
+
}
|
303
|
+
wrapCallback(err);
|
304
|
+
});
|
305
|
+
}, callback);
|
306
|
+
}
|
307
|
+
/**
|
308
|
+
* Freezes the indexing plan for execution of queries.
|
309
|
+
*
|
310
|
+
* @param indexName The name of the index to freeze the plan of.
|
311
|
+
* @param options Optional parameters for this operation.
|
312
|
+
* @param callback A node-style callback to be invoked after execution.
|
313
|
+
*/
|
314
|
+
async freezePlan(indexName, options, callback) {
|
315
|
+
if (options instanceof Function) {
|
316
|
+
callback = arguments[1];
|
317
|
+
options = undefined;
|
318
|
+
}
|
319
|
+
if (!options) {
|
320
|
+
options = {};
|
321
|
+
}
|
322
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
323
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
324
|
+
this._cluster.conn.managementSearchIndexControlPlanFreeze({
|
325
|
+
index_name: indexName,
|
326
|
+
freeze: true,
|
327
|
+
timeout: timeout,
|
328
|
+
bucket_name: this._bucketName,
|
329
|
+
scope_name: this._scopeName,
|
330
|
+
}, (cppErr) => {
|
331
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
332
|
+
if (err) {
|
333
|
+
return wrapCallback(err, null);
|
334
|
+
}
|
335
|
+
wrapCallback(err);
|
336
|
+
});
|
337
|
+
}, callback);
|
338
|
+
}
|
339
|
+
/**
|
340
|
+
* Unfreezes the indexing plan for execution of queries.
|
341
|
+
*
|
342
|
+
* @param indexName The name of the index to freeze the plan of.
|
343
|
+
* @param options Optional parameters for this operation.
|
344
|
+
* @param callback A node-style callback to be invoked after execution.
|
345
|
+
*/
|
346
|
+
async unfreezePlan(indexName, options, callback) {
|
347
|
+
if (options instanceof Function) {
|
348
|
+
callback = arguments[1];
|
349
|
+
options = undefined;
|
350
|
+
}
|
351
|
+
if (!options) {
|
352
|
+
options = {};
|
353
|
+
}
|
354
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
355
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
356
|
+
this._cluster.conn.managementSearchIndexControlPlanFreeze({
|
357
|
+
index_name: indexName,
|
358
|
+
freeze: false,
|
359
|
+
timeout: timeout,
|
360
|
+
bucket_name: this._bucketName,
|
361
|
+
scope_name: this._scopeName,
|
362
|
+
}, (cppErr) => {
|
363
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
364
|
+
if (err) {
|
365
|
+
return wrapCallback(err, null);
|
366
|
+
}
|
367
|
+
wrapCallback(err);
|
368
|
+
});
|
369
|
+
}, callback);
|
370
|
+
}
|
371
|
+
/**
|
372
|
+
* Performs analysis of a specific document by an index.
|
373
|
+
*
|
374
|
+
* @param indexName The name of the index to use for the analysis.
|
375
|
+
* @param document The document to analyze.
|
376
|
+
* @param options Optional parameters for this operation.
|
377
|
+
* @param callback A node-style callback to be invoked after execution.
|
378
|
+
*/
|
379
|
+
async analyzeDocument(indexName, document, options, callback) {
|
380
|
+
if (options instanceof Function) {
|
381
|
+
callback = arguments[2];
|
382
|
+
options = undefined;
|
383
|
+
}
|
384
|
+
if (!options) {
|
385
|
+
options = {};
|
386
|
+
}
|
387
|
+
const timeout = options.timeout || this._cluster.managementTimeout;
|
388
|
+
return utilities_1.PromiseHelper.wrap((wrapCallback) => {
|
389
|
+
this._cluster.conn.managementSearchIndexAnalyzeDocument({
|
390
|
+
index_name: indexName,
|
391
|
+
encoded_document: JSON.stringify(document),
|
392
|
+
timeout: timeout,
|
393
|
+
bucket_name: this._bucketName,
|
394
|
+
scope_name: this._scopeName,
|
395
|
+
}, (cppErr, resp) => {
|
396
|
+
const err = (0, bindingutilities_1.errorFromCpp)(cppErr);
|
397
|
+
if (err) {
|
398
|
+
return wrapCallback(err, null);
|
399
|
+
}
|
400
|
+
const result = JSON.parse(resp.analysis);
|
401
|
+
wrapCallback(result, null);
|
402
|
+
});
|
403
|
+
}, callback);
|
404
|
+
}
|
405
|
+
}
|
406
|
+
exports.ScopeSearchIndexManager = ScopeSearchIndexManager;
|
package/dist/sdspecs.js
CHANGED
@@ -81,19 +81,19 @@ class MutateInMacro {
|
|
81
81
|
* A macro which references the cas of a document.
|
82
82
|
*/
|
83
83
|
static get Cas() {
|
84
|
-
return new MutateInMacro('${
|
84
|
+
return new MutateInMacro('${Mutation.CAS}');
|
85
85
|
}
|
86
86
|
/**
|
87
87
|
* A macro which references the seqno of a document.
|
88
88
|
*/
|
89
89
|
static get SeqNo() {
|
90
|
-
return new MutateInMacro('${
|
90
|
+
return new MutateInMacro('${Mutation.seqno}');
|
91
91
|
}
|
92
92
|
/**
|
93
93
|
* A macro which references the crc32 of the value of a document.
|
94
94
|
*/
|
95
95
|
static get ValueCrc32c() {
|
96
|
-
return new MutateInMacro('${
|
96
|
+
return new MutateInMacro('${Mutation.value_crc32c}');
|
97
97
|
}
|
98
98
|
}
|
99
99
|
exports.MutateInMacro = MutateInMacro;
|
@@ -200,18 +200,19 @@ class MutateInSpec {
|
|
200
200
|
options = {};
|
201
201
|
}
|
202
202
|
let flags = 0;
|
203
|
-
if (
|
204
|
-
value = value._value;
|
203
|
+
if (options.createPath) {
|
205
204
|
flags |=
|
206
205
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag
|
207
|
-
.
|
206
|
+
.create_parents;
|
208
207
|
}
|
209
|
-
if (
|
208
|
+
if (value instanceof MutateInMacro) {
|
209
|
+
value = value._value;
|
210
210
|
flags |=
|
211
211
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag
|
212
|
-
.
|
212
|
+
.expand_macros |
|
213
|
+
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag.xattr;
|
213
214
|
}
|
214
|
-
if (options.xattr) {
|
215
|
+
else if (options.xattr) {
|
215
216
|
flags |=
|
216
217
|
binding_1.default.protocol_mutate_in_request_body_mutate_in_specs_path_flag.xattr;
|
217
218
|
}
|
package/dist/sdutils.d.ts
CHANGED
package/dist/sdutils.js
CHANGED
@@ -100,5 +100,9 @@ class SdUtils {
|
|
100
100
|
const parts = this._parsePath(path);
|
101
101
|
return this._getByPath(value, parts);
|
102
102
|
}
|
103
|
+
static convertMacroCasToCas(cas) {
|
104
|
+
const buf = Buffer.from(cas.startsWith('0x') ? cas.slice(2) : cas, 'hex');
|
105
|
+
return `0x${buf.reverse().toString('hex')}`;
|
106
|
+
}
|
103
107
|
}
|
104
108
|
exports.SdUtils = SdUtils;
|
package/dist/searchexecutor.d.ts
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
import { Cluster } from './cluster';
|
2
2
|
import { SearchQuery } from './searchquery';
|
3
|
-
import { SearchMetaData, SearchQueryOptions, SearchResult, SearchRow } from './searchtypes';
|
3
|
+
import { SearchMetaData, SearchQueryOptions, SearchRequest, SearchResult, SearchRow } from './searchtypes';
|
4
4
|
import { StreamableRowPromise } from './streamablepromises';
|
5
5
|
/**
|
6
6
|
* @internal
|
7
7
|
*/
|
8
8
|
export declare class SearchExecutor {
|
9
9
|
private _cluster;
|
10
|
+
private _bucketName;
|
11
|
+
private _scopeName;
|
10
12
|
/**
|
11
13
|
* @internal
|
12
14
|
*/
|
13
|
-
constructor(cluster: Cluster);
|
15
|
+
constructor(cluster: Cluster, bucketName?: string, scopeName?: string);
|
14
16
|
/**
|
15
17
|
* @internal
|
16
18
|
*/
|
17
|
-
query(indexName: string, query: SearchQuery, options: SearchQueryOptions): StreamableRowPromise<SearchResult, SearchRow, SearchMetaData>;
|
19
|
+
query(indexName: string, query: SearchQuery | SearchRequest, options: SearchQueryOptions): StreamableRowPromise<SearchResult, SearchRow, SearchMetaData>;
|
18
20
|
}
|