@redis/search 1.1.1 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,5 +4,5 @@ import { RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
|
4
4
|
export declare const IS_READ_ONLY = true;
|
|
5
5
|
export declare function transformArguments(index: string, query: string, options?: ProfileOptions & SearchOptions): RedisCommandArguments;
|
|
6
6
|
type ProfileSearchRawReply = ProfileRawReply<SearchRawReply>;
|
|
7
|
-
export declare function transformReply(reply: ProfileSearchRawReply): ProfileReply;
|
|
7
|
+
export declare function transformReply(reply: ProfileSearchRawReply, withoutDocuments: boolean): ProfileReply;
|
|
8
8
|
export {};
|
|
@@ -5,7 +5,7 @@ const SEARCH_1 = require("./SEARCH");
|
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
exports.IS_READ_ONLY = true;
|
|
7
7
|
function transformArguments(index, query, options) {
|
|
8
|
-
|
|
8
|
+
let args = ['FT.PROFILE', index, 'SEARCH'];
|
|
9
9
|
if (options?.LIMITED) {
|
|
10
10
|
args.push('LIMITED');
|
|
11
11
|
}
|
|
@@ -13,9 +13,9 @@ function transformArguments(index, query, options) {
|
|
|
13
13
|
return (0, _1.pushSearchOptions)(args, options);
|
|
14
14
|
}
|
|
15
15
|
exports.transformArguments = transformArguments;
|
|
16
|
-
function transformReply(reply) {
|
|
16
|
+
function transformReply(reply, withoutDocuments) {
|
|
17
17
|
return {
|
|
18
|
-
results: (0, SEARCH_1.transformReply)(reply[0]),
|
|
18
|
+
results: (0, SEARCH_1.transformReply)(reply[0], withoutDocuments),
|
|
19
19
|
profile: (0, _1.transformProfile)(reply[1])
|
|
20
20
|
};
|
|
21
21
|
}
|
|
@@ -37,4 +37,4 @@ export interface SearchOptions {
|
|
|
37
37
|
}
|
|
38
38
|
export declare function transformArguments(index: string, query: string, options?: SearchOptions): RedisCommandArguments;
|
|
39
39
|
export type SearchRawReply = Array<any>;
|
|
40
|
-
export declare function transformReply(reply: SearchRawReply): SearchReply;
|
|
40
|
+
export declare function transformReply(reply: SearchRawReply, withoutDocuments: boolean): SearchReply;
|
package/dist/commands/SEARCH.js
CHANGED
|
@@ -8,13 +8,13 @@ function transformArguments(index, query, options) {
|
|
|
8
8
|
return (0, _1.pushSearchOptions)(['FT.SEARCH', index, query], options);
|
|
9
9
|
}
|
|
10
10
|
exports.transformArguments = transformArguments;
|
|
11
|
-
function transformReply(reply) {
|
|
11
|
+
function transformReply(reply, withoutDocuments) {
|
|
12
12
|
const documents = [];
|
|
13
13
|
let i = 1;
|
|
14
14
|
while (i < reply.length) {
|
|
15
15
|
documents.push({
|
|
16
16
|
id: reply[i++],
|
|
17
|
-
value: documentValue(reply[i++])
|
|
17
|
+
value: withoutDocuments ? Object.create(null) : documentValue(reply[i++])
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
return {
|
|
@@ -25,8 +25,6 @@ function transformReply(reply) {
|
|
|
25
25
|
exports.transformReply = transformReply;
|
|
26
26
|
function documentValue(tuples) {
|
|
27
27
|
const message = Object.create(null);
|
|
28
|
-
if (tuples === undefined)
|
|
29
|
-
return message;
|
|
30
28
|
let i = 0;
|
|
31
29
|
while (i < tuples.length) {
|
|
32
30
|
const key = tuples[i++], value = tuples[i++];
|
package/dist/commands/index.js
CHANGED
|
@@ -359,6 +359,9 @@ function pushSearchOptions(args, options) {
|
|
|
359
359
|
if (options?.DIALECT) {
|
|
360
360
|
args.push('DIALECT', options.DIALECT.toString());
|
|
361
361
|
}
|
|
362
|
+
if (options?.RETURN?.length === 0) {
|
|
363
|
+
args.preserve = true;
|
|
364
|
+
}
|
|
362
365
|
return args;
|
|
363
366
|
}
|
|
364
367
|
exports.pushSearchOptions = pushSearchOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis/search",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -18,12 +18,12 @@
|
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
20
20
|
"@redis/test-utils": "*",
|
|
21
|
-
"@types/node": "^18.
|
|
21
|
+
"@types/node": "^18.14.1",
|
|
22
22
|
"nyc": "^15.1.0",
|
|
23
23
|
"release-it": "^15.6.0",
|
|
24
24
|
"source-map-support": "^0.5.21",
|
|
25
25
|
"ts-node": "^10.9.1",
|
|
26
|
-
"typedoc": "^0.23.
|
|
27
|
-
"typescript": "^4.9.
|
|
26
|
+
"typedoc": "^0.23.25",
|
|
27
|
+
"typescript": "^4.9.5"
|
|
28
28
|
}
|
|
29
29
|
}
|