@redis/search 1.0.6 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -8
- package/dist/commands/AGGREGATE.d.ts +6 -4
- package/dist/commands/AGGREGATE.js +3 -1
- package/dist/commands/AGGREGATE_WITHCURSOR.d.ts +14 -0
- package/dist/commands/AGGREGATE_WITHCURSOR.js +23 -0
- package/dist/commands/CURSOR_DEL.d.ts +4 -0
- package/dist/commands/CURSOR_DEL.js +13 -0
- package/dist/commands/CURSOR_READ.d.ts +5 -0
- package/dist/commands/CURSOR_READ.js +16 -0
- package/dist/commands/INFO.d.ts +1 -1
- package/dist/commands/PROFILE_AGGREGATE.d.ts +1 -1
- package/dist/commands/PROFILE_SEARCH.d.ts +1 -1
- package/dist/commands/SEARCH.d.ts +1 -1
- package/dist/commands/SEARCH.js +24 -7
- package/dist/commands/SPELLCHECK.d.ts +2 -2
- package/dist/commands/SUGGET_WITHSCORES_WITHPAYLOADS.d.ts +1 -1
- package/dist/commands/index.d.ts +25 -14
- package/dist/commands/index.js +15 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -18,15 +18,14 @@ Before we can perform any searches, we need to tell RediSearch how to index our
|
|
|
18
18
|
await client.ft.create('idx:animals', {
|
|
19
19
|
name: {
|
|
20
20
|
type: SchemaFieldTypes.TEXT,
|
|
21
|
-
|
|
21
|
+
SORTABLE: true
|
|
22
22
|
},
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
);
|
|
23
|
+
species: SchemaFieldTypes.TAG,
|
|
24
|
+
age: SchemaFieldTypes.NUMERIC
|
|
25
|
+
}, {
|
|
26
|
+
ON: 'HASH',
|
|
27
|
+
PREFIX: 'noderedis:animals'
|
|
28
|
+
});
|
|
30
29
|
```
|
|
31
30
|
|
|
32
31
|
See the [`FT.CREATE` documentation](https://oss.redis.com/redisearch/Commands/#ftcreate) for information about the different field types and additional options.
|
|
@@ -29,7 +29,7 @@ interface GroupByReducer<T extends AggregateGroupByReducers> {
|
|
|
29
29
|
type: T;
|
|
30
30
|
AS?: string;
|
|
31
31
|
}
|
|
32
|
-
|
|
32
|
+
type CountReducer = GroupByReducer<AggregateGroupByReducers.COUNT>;
|
|
33
33
|
interface CountDistinctReducer extends GroupByReducer<AggregateGroupByReducers.COUNT_DISTINCT> {
|
|
34
34
|
property: PropertyName;
|
|
35
35
|
}
|
|
@@ -69,7 +69,7 @@ interface RandomSampleReducer extends GroupByReducer<AggregateGroupByReducers.RA
|
|
|
69
69
|
property: PropertyName;
|
|
70
70
|
sampleSize: number;
|
|
71
71
|
}
|
|
72
|
-
|
|
72
|
+
type GroupByReducers = CountReducer | CountDistinctReducer | CountDistinctishReducer | SumReducer | MinReducer | MaxReducer | AvgReducer | StdDevReducer | QuantileReducer | ToListReducer | FirstValueReducer | RandomSampleReducer;
|
|
73
73
|
interface GroupByStep extends AggregateStep<AggregateSteps.GROUPBY> {
|
|
74
74
|
properties?: PropertyName | Array<PropertyName>;
|
|
75
75
|
REDUCE: GroupByReducers | Array<GroupByReducers>;
|
|
@@ -89,7 +89,7 @@ interface LimitStep extends AggregateStep<AggregateSteps.LIMIT> {
|
|
|
89
89
|
interface FilterStep extends AggregateStep<AggregateSteps.FILTER> {
|
|
90
90
|
expression: string;
|
|
91
91
|
}
|
|
92
|
-
|
|
92
|
+
type LoadField = PropertyName | {
|
|
93
93
|
identifier: PropertyName;
|
|
94
94
|
AS?: string;
|
|
95
95
|
};
|
|
@@ -100,9 +100,11 @@ export interface AggregateOptions {
|
|
|
100
100
|
PARAMS?: Params;
|
|
101
101
|
DIALECT?: number;
|
|
102
102
|
}
|
|
103
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
104
|
+
export declare const IS_READ_ONLY = true;
|
|
103
105
|
export declare function transformArguments(index: string, query: string, options?: AggregateOptions): RedisCommandArguments;
|
|
104
106
|
export declare function pushAggregatehOptions(args: RedisCommandArguments, options?: AggregateOptions): RedisCommandArguments;
|
|
105
|
-
export
|
|
107
|
+
export type AggregateRawReply = [
|
|
106
108
|
total: number,
|
|
107
109
|
...results: Array<Array<RedisCommandArgument>>
|
|
108
110
|
];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.transformReply = exports.pushAggregatehOptions = exports.transformArguments = exports.AggregateGroupByReducers = exports.AggregateSteps = void 0;
|
|
3
|
+
exports.transformReply = exports.pushAggregatehOptions = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = exports.AggregateGroupByReducers = exports.AggregateSteps = void 0;
|
|
4
4
|
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
5
|
const _1 = require(".");
|
|
6
6
|
var AggregateSteps;
|
|
@@ -27,6 +27,8 @@ var AggregateGroupByReducers;
|
|
|
27
27
|
AggregateGroupByReducers["FIRST_VALUE"] = "FIRST_VALUE";
|
|
28
28
|
AggregateGroupByReducers["RANDOM_SAMPLE"] = "RANDOM_SAMPLE";
|
|
29
29
|
})(AggregateGroupByReducers = exports.AggregateGroupByReducers || (exports.AggregateGroupByReducers = {}));
|
|
30
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
31
|
+
exports.IS_READ_ONLY = true;
|
|
30
32
|
function transformArguments(index, query, options) {
|
|
31
33
|
return pushAggregatehOptions(['FT.AGGREGATE', index, query], options);
|
|
32
34
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AggregateOptions, AggregateRawReply, AggregateReply } from './AGGREGATE';
|
|
2
|
+
export { FIRST_KEY_INDEX, IS_READ_ONLY } from './AGGREGATE';
|
|
3
|
+
interface AggregateWithCursorOptions extends AggregateOptions {
|
|
4
|
+
COUNT?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function transformArguments(index: string, query: string, options?: AggregateWithCursorOptions): import("@redis/client/dist/lib/commands").RedisCommandArguments;
|
|
7
|
+
type AggregateWithCursorRawReply = [
|
|
8
|
+
result: AggregateRawReply,
|
|
9
|
+
cursor: number
|
|
10
|
+
];
|
|
11
|
+
interface AggregateWithCursorReply extends AggregateReply {
|
|
12
|
+
cursor: number;
|
|
13
|
+
}
|
|
14
|
+
export declare function transformReply(reply: AggregateWithCursorRawReply): AggregateWithCursorReply;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
const AGGREGATE_1 = require("./AGGREGATE");
|
|
5
|
+
var AGGREGATE_2 = require("./AGGREGATE");
|
|
6
|
+
Object.defineProperty(exports, "FIRST_KEY_INDEX", { enumerable: true, get: function () { return AGGREGATE_2.FIRST_KEY_INDEX; } });
|
|
7
|
+
Object.defineProperty(exports, "IS_READ_ONLY", { enumerable: true, get: function () { return AGGREGATE_2.IS_READ_ONLY; } });
|
|
8
|
+
function transformArguments(index, query, options) {
|
|
9
|
+
const args = (0, AGGREGATE_1.transformArguments)(index, query, options);
|
|
10
|
+
args.push('WITHCURSOR');
|
|
11
|
+
if (options?.COUNT) {
|
|
12
|
+
args.push('COUNT', options.COUNT.toString());
|
|
13
|
+
}
|
|
14
|
+
return args;
|
|
15
|
+
}
|
|
16
|
+
exports.transformArguments = transformArguments;
|
|
17
|
+
function transformReply(reply) {
|
|
18
|
+
return {
|
|
19
|
+
...(0, AGGREGATE_1.transformReply)(reply[0]),
|
|
20
|
+
cursor: reply[1]
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
exports.transformReply = transformReply;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { RedisCommandArgument } from '@redis/client/dist/lib/commands';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
export declare function transformArguments(index: RedisCommandArgument, cursorId: number): RedisCommandArgument[];
|
|
4
|
+
export declare function transformReply(): 'OK';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformArguments = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
5
|
+
function transformArguments(index, cursorId) {
|
|
6
|
+
return [
|
|
7
|
+
'FT.CURSOR',
|
|
8
|
+
'DEL',
|
|
9
|
+
index,
|
|
10
|
+
cursorId.toString()
|
|
11
|
+
];
|
|
12
|
+
}
|
|
13
|
+
exports.transformArguments = transformArguments;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands';
|
|
2
|
+
export declare const FIRST_KEY_INDEX = 1;
|
|
3
|
+
export declare const IS_READ_ONLY = true;
|
|
4
|
+
export declare function transformArguments(index: RedisCommandArgument, cursor: number): RedisCommandArguments;
|
|
5
|
+
export { transformReply } from './AGGREGATE_WITHCURSOR';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
+
exports.FIRST_KEY_INDEX = 1;
|
|
5
|
+
exports.IS_READ_ONLY = true;
|
|
6
|
+
function transformArguments(index, cursor) {
|
|
7
|
+
return [
|
|
8
|
+
'FT.CURSOR',
|
|
9
|
+
'READ',
|
|
10
|
+
index,
|
|
11
|
+
cursor.toString()
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
exports.transformArguments = transformArguments;
|
|
15
|
+
var AGGREGATE_WITHCURSOR_1 = require("./AGGREGATE_WITHCURSOR");
|
|
16
|
+
Object.defineProperty(exports, "transformReply", { enumerable: true, get: function () { return AGGREGATE_WITHCURSOR_1.transformReply; } });
|
package/dist/commands/INFO.d.ts
CHANGED
|
@@ -2,6 +2,6 @@ import { AggregateOptions, AggregateRawReply } from './AGGREGATE';
|
|
|
2
2
|
import { ProfileOptions, ProfileRawReply, ProfileReply } from '.';
|
|
3
3
|
export declare const IS_READ_ONLY = true;
|
|
4
4
|
export declare function transformArguments(index: string, query: string, options?: ProfileOptions & AggregateOptions): Array<string>;
|
|
5
|
-
|
|
5
|
+
type ProfileAggeregateRawReply = ProfileRawReply<AggregateRawReply>;
|
|
6
6
|
export declare function transformReply(reply: ProfileAggeregateRawReply): ProfileReply;
|
|
7
7
|
export {};
|
|
@@ -3,6 +3,6 @@ import { ProfileOptions, ProfileRawReply, ProfileReply } from '.';
|
|
|
3
3
|
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
7
|
export declare function transformReply(reply: ProfileSearchRawReply): ProfileReply;
|
|
8
8
|
export {};
|
|
@@ -36,5 +36,5 @@ export interface SearchOptions {
|
|
|
36
36
|
DIALECT?: number;
|
|
37
37
|
}
|
|
38
38
|
export declare function transformArguments(index: string, query: string, options?: SearchOptions): RedisCommandArguments;
|
|
39
|
-
export
|
|
39
|
+
export type SearchRawReply = Array<any>;
|
|
40
40
|
export declare function transformReply(reply: SearchRawReply): SearchReply;
|
package/dist/commands/SEARCH.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.transformReply = exports.transformArguments = exports.IS_READ_ONLY = exports.FIRST_KEY_INDEX = void 0;
|
|
4
|
-
const generic_transformers_1 = require("@redis/client/dist/lib/commands/generic-transformers");
|
|
5
4
|
const _1 = require(".");
|
|
6
5
|
exports.FIRST_KEY_INDEX = 1;
|
|
7
6
|
exports.IS_READ_ONLY = true;
|
|
@@ -11,13 +10,11 @@ function transformArguments(index, query, options) {
|
|
|
11
10
|
exports.transformArguments = transformArguments;
|
|
12
11
|
function transformReply(reply) {
|
|
13
12
|
const documents = [];
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
let i = 1;
|
|
14
|
+
while (i < reply.length) {
|
|
16
15
|
documents.push({
|
|
17
|
-
id: reply[i],
|
|
18
|
-
value:
|
|
19
|
-
JSON.parse(tuples[1]) :
|
|
20
|
-
(0, generic_transformers_1.transformTuplesReply)(tuples)
|
|
16
|
+
id: reply[i++],
|
|
17
|
+
value: documentValue(reply[i++])
|
|
21
18
|
});
|
|
22
19
|
}
|
|
23
20
|
return {
|
|
@@ -26,3 +23,23 @@ function transformReply(reply) {
|
|
|
26
23
|
};
|
|
27
24
|
}
|
|
28
25
|
exports.transformReply = transformReply;
|
|
26
|
+
function documentValue(tuples) {
|
|
27
|
+
const message = Object.create(null);
|
|
28
|
+
if (tuples === undefined)
|
|
29
|
+
return message;
|
|
30
|
+
let i = 0;
|
|
31
|
+
while (i < tuples.length) {
|
|
32
|
+
const key = tuples[i++], value = tuples[i++];
|
|
33
|
+
if (key === '$') { // might be a JSON reply
|
|
34
|
+
try {
|
|
35
|
+
Object.assign(message, JSON.parse(value));
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// set as a regular property if not a valid JSON
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
message[key] = value;
|
|
43
|
+
}
|
|
44
|
+
return message;
|
|
45
|
+
}
|
|
@@ -8,12 +8,12 @@ interface SpellCheckOptions {
|
|
|
8
8
|
DIALECT?: number;
|
|
9
9
|
}
|
|
10
10
|
export declare function transformArguments(index: string, query: string, options?: SpellCheckOptions): Array<string>;
|
|
11
|
-
|
|
11
|
+
type SpellCheckRawReply = Array<[
|
|
12
12
|
_: string,
|
|
13
13
|
term: string,
|
|
14
14
|
suggestions: Array<[score: string, suggestion: string]>
|
|
15
15
|
]>;
|
|
16
|
-
|
|
16
|
+
type SpellCheckReply = Array<{
|
|
17
17
|
term: string;
|
|
18
18
|
suggestions: Array<{
|
|
19
19
|
score: number;
|
|
@@ -3,5 +3,5 @@ import { SuggestionWithPayload } from './SUGGET_WITHPAYLOADS';
|
|
|
3
3
|
import { SuggestionWithScores } from './SUGGET_WITHSCORES';
|
|
4
4
|
export { IS_READ_ONLY } from './SUGGET';
|
|
5
5
|
export declare function transformArguments(key: string, prefix: string, options?: SugGetOptions): Array<string>;
|
|
6
|
-
|
|
6
|
+
type SuggestionWithScoresAndPayloads = SuggestionWithScores & SuggestionWithPayload;
|
|
7
7
|
export declare function transformReply(rawReply: Array<string | null> | null): Array<SuggestionWithScoresAndPayloads> | null;
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as _LIST from './_LIST';
|
|
2
2
|
import * as ALTER from './ALTER';
|
|
3
|
+
import * as AGGREGATE_WITHCURSOR from './AGGREGATE_WITHCURSOR';
|
|
3
4
|
import * as AGGREGATE from './AGGREGATE';
|
|
4
5
|
import * as ALIASADD from './ALIASADD';
|
|
5
6
|
import * as ALIASDEL from './ALIASDEL';
|
|
@@ -7,6 +8,8 @@ import * as ALIASUPDATE from './ALIASUPDATE';
|
|
|
7
8
|
import * as CONFIG_GET from './CONFIG_GET';
|
|
8
9
|
import * as CONFIG_SET from './CONFIG_SET';
|
|
9
10
|
import * as CREATE from './CREATE';
|
|
11
|
+
import * as CURSOR_DEL from './CURSOR_DEL';
|
|
12
|
+
import * as CURSOR_READ from './CURSOR_READ';
|
|
10
13
|
import * as DICTADD from './DICTADD';
|
|
11
14
|
import * as DICTDEL from './DICTDEL';
|
|
12
15
|
import * as DICTDUMP from './DICTDUMP';
|
|
@@ -35,6 +38,8 @@ declare const _default: {
|
|
|
35
38
|
_list: typeof _LIST;
|
|
36
39
|
ALTER: typeof ALTER;
|
|
37
40
|
alter: typeof ALTER;
|
|
41
|
+
AGGREGATE_WITHCURSOR: typeof AGGREGATE_WITHCURSOR;
|
|
42
|
+
aggregateWithCursor: typeof AGGREGATE_WITHCURSOR;
|
|
38
43
|
AGGREGATE: typeof AGGREGATE;
|
|
39
44
|
aggregate: typeof AGGREGATE;
|
|
40
45
|
ALIASADD: typeof ALIASADD;
|
|
@@ -49,6 +54,10 @@ declare const _default: {
|
|
|
49
54
|
configSet: typeof CONFIG_SET;
|
|
50
55
|
CREATE: typeof CREATE;
|
|
51
56
|
create: typeof CREATE;
|
|
57
|
+
CURSOR_DEL: typeof CURSOR_DEL;
|
|
58
|
+
cursorDel: typeof CURSOR_DEL;
|
|
59
|
+
CURSOR_READ: typeof CURSOR_READ;
|
|
60
|
+
cursorRead: typeof CURSOR_READ;
|
|
52
61
|
DICTADD: typeof DICTADD;
|
|
53
62
|
dictAdd: typeof DICTADD;
|
|
54
63
|
DICTDEL: typeof DICTDEL;
|
|
@@ -120,9 +129,9 @@ export declare enum RedisSearchLanguages {
|
|
|
120
129
|
TURKISH = "Turkish",
|
|
121
130
|
CHINESE = "Chinese"
|
|
122
131
|
}
|
|
123
|
-
export
|
|
124
|
-
export
|
|
125
|
-
BY:
|
|
132
|
+
export type PropertyName = `${'@' | '$.'}${string}`;
|
|
133
|
+
export type SortByProperty = string | {
|
|
134
|
+
BY: string;
|
|
126
135
|
DIRECTION?: 'ASC' | 'DESC';
|
|
127
136
|
};
|
|
128
137
|
export declare function pushSortByProperty(args: RedisCommandArguments, sortBy: SortByProperty): void;
|
|
@@ -135,11 +144,11 @@ export declare enum SchemaFieldTypes {
|
|
|
135
144
|
TAG = "TAG",
|
|
136
145
|
VECTOR = "VECTOR"
|
|
137
146
|
}
|
|
138
|
-
|
|
147
|
+
type CreateSchemaField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = T | ({
|
|
139
148
|
type: T;
|
|
140
149
|
AS?: string;
|
|
141
150
|
} & E);
|
|
142
|
-
|
|
151
|
+
type CreateSchemaCommonField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = CreateSchemaField<T, ({
|
|
143
152
|
SORTABLE?: true | 'UNF';
|
|
144
153
|
NOINDEX?: true;
|
|
145
154
|
} & E)>;
|
|
@@ -149,32 +158,34 @@ export declare enum SchemaTextFieldPhonetics {
|
|
|
149
158
|
FM_PT = "dm:pt",
|
|
150
159
|
DM_ES = "dm:es"
|
|
151
160
|
}
|
|
152
|
-
|
|
161
|
+
type CreateSchemaTextField = CreateSchemaCommonField<SchemaFieldTypes.TEXT, {
|
|
153
162
|
NOSTEM?: true;
|
|
154
163
|
WEIGHT?: number;
|
|
155
164
|
PHONETIC?: SchemaTextFieldPhonetics;
|
|
165
|
+
WITHSUFFIXTRIE?: boolean;
|
|
156
166
|
}>;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
167
|
+
type CreateSchemaNumericField = CreateSchemaCommonField<SchemaFieldTypes.NUMERIC>;
|
|
168
|
+
type CreateSchemaGeoField = CreateSchemaCommonField<SchemaFieldTypes.GEO>;
|
|
169
|
+
type CreateSchemaTagField = CreateSchemaCommonField<SchemaFieldTypes.TAG, {
|
|
160
170
|
SEPARATOR?: string;
|
|
161
171
|
CASESENSITIVE?: true;
|
|
172
|
+
WITHSUFFIXTRIE?: boolean;
|
|
162
173
|
}>;
|
|
163
174
|
export declare enum VectorAlgorithms {
|
|
164
175
|
FLAT = "FLAT",
|
|
165
176
|
HNSW = "HNSW"
|
|
166
177
|
}
|
|
167
|
-
|
|
178
|
+
type CreateSchemaVectorField<T extends VectorAlgorithms, A extends Record<string, unknown>> = CreateSchemaField<SchemaFieldTypes.VECTOR, {
|
|
168
179
|
ALGORITHM: T;
|
|
169
180
|
TYPE: string;
|
|
170
181
|
DIM: number;
|
|
171
182
|
DISTANCE_METRIC: 'L2' | 'IP' | 'COSINE';
|
|
172
183
|
INITIAL_CAP?: number;
|
|
173
184
|
} & A>;
|
|
174
|
-
|
|
185
|
+
type CreateSchemaFlatVectorField = CreateSchemaVectorField<VectorAlgorithms.FLAT, {
|
|
175
186
|
BLOCK_SIZE?: number;
|
|
176
187
|
}>;
|
|
177
|
-
|
|
188
|
+
type CreateSchemaHNSWVectorField = CreateSchemaVectorField<VectorAlgorithms.HNSW, {
|
|
178
189
|
M?: number;
|
|
179
190
|
EF_CONSTRUCTION?: number;
|
|
180
191
|
EF_RUNTIME?: number;
|
|
@@ -183,7 +194,7 @@ export interface RediSearchSchema {
|
|
|
183
194
|
[field: string]: CreateSchemaTextField | CreateSchemaNumericField | CreateSchemaGeoField | CreateSchemaTagField | CreateSchemaFlatVectorField | CreateSchemaHNSWVectorField;
|
|
184
195
|
}
|
|
185
196
|
export declare function pushSchema(args: RedisCommandArguments, schema: RediSearchSchema): void;
|
|
186
|
-
export
|
|
197
|
+
export type Params = Record<string, RedisCommandArgument | number>;
|
|
187
198
|
export declare function pushParamsArgs(args: RedisCommandArguments, params?: Params): RedisCommandArguments;
|
|
188
199
|
export declare function pushSearchOptions(args: RedisCommandArguments, options?: SearchOptions): RedisCommandArguments;
|
|
189
200
|
interface SearchDocumentValue {
|
|
@@ -199,7 +210,7 @@ export interface SearchReply {
|
|
|
199
210
|
export interface ProfileOptions {
|
|
200
211
|
LIMITED?: true;
|
|
201
212
|
}
|
|
202
|
-
export
|
|
213
|
+
export type ProfileRawReply<T> = [
|
|
203
214
|
results: T,
|
|
204
215
|
profile: [
|
|
205
216
|
_: string,
|
package/dist/commands/index.js
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.transformProfile = exports.pushSearchOptions = exports.pushParamsArgs = exports.pushSchema = exports.VectorAlgorithms = exports.SchemaTextFieldPhonetics = exports.SchemaFieldTypes = exports.pushArgumentsWithLength = exports.pushSortByArguments = exports.pushSortByProperty = exports.RedisSearchLanguages = void 0;
|
|
4
4
|
const _LIST = require("./_LIST");
|
|
5
5
|
const ALTER = require("./ALTER");
|
|
6
|
+
const AGGREGATE_WITHCURSOR = require("./AGGREGATE_WITHCURSOR");
|
|
6
7
|
const AGGREGATE = require("./AGGREGATE");
|
|
7
8
|
const ALIASADD = require("./ALIASADD");
|
|
8
9
|
const ALIASDEL = require("./ALIASDEL");
|
|
@@ -10,6 +11,8 @@ const ALIASUPDATE = require("./ALIASUPDATE");
|
|
|
10
11
|
const CONFIG_GET = require("./CONFIG_GET");
|
|
11
12
|
const CONFIG_SET = require("./CONFIG_SET");
|
|
12
13
|
const CREATE = require("./CREATE");
|
|
14
|
+
const CURSOR_DEL = require("./CURSOR_DEL");
|
|
15
|
+
const CURSOR_READ = require("./CURSOR_READ");
|
|
13
16
|
const DICTADD = require("./DICTADD");
|
|
14
17
|
const DICTDEL = require("./DICTDEL");
|
|
15
18
|
const DICTDUMP = require("./DICTDUMP");
|
|
@@ -37,6 +40,8 @@ exports.default = {
|
|
|
37
40
|
_list: _LIST,
|
|
38
41
|
ALTER,
|
|
39
42
|
alter: ALTER,
|
|
43
|
+
AGGREGATE_WITHCURSOR,
|
|
44
|
+
aggregateWithCursor: AGGREGATE_WITHCURSOR,
|
|
40
45
|
AGGREGATE,
|
|
41
46
|
aggregate: AGGREGATE,
|
|
42
47
|
ALIASADD,
|
|
@@ -51,6 +56,10 @@ exports.default = {
|
|
|
51
56
|
configSet: CONFIG_SET,
|
|
52
57
|
CREATE,
|
|
53
58
|
create: CREATE,
|
|
59
|
+
CURSOR_DEL,
|
|
60
|
+
cursorDel: CURSOR_DEL,
|
|
61
|
+
CURSOR_READ,
|
|
62
|
+
cursorRead: CURSOR_READ,
|
|
54
63
|
DICTADD,
|
|
55
64
|
dictAdd: DICTADD,
|
|
56
65
|
DICTDEL,
|
|
@@ -198,6 +207,9 @@ function pushSchema(args, schema) {
|
|
|
198
207
|
if (fieldOptions.PHONETIC) {
|
|
199
208
|
args.push('PHONETIC', fieldOptions.PHONETIC);
|
|
200
209
|
}
|
|
210
|
+
if (fieldOptions.WITHSUFFIXTRIE) {
|
|
211
|
+
args.push('WITHSUFFIXTRIE');
|
|
212
|
+
}
|
|
201
213
|
break;
|
|
202
214
|
// case SchemaFieldTypes.NUMERIC:
|
|
203
215
|
// case SchemaFieldTypes.GEO:
|
|
@@ -209,6 +221,9 @@ function pushSchema(args, schema) {
|
|
|
209
221
|
if (fieldOptions.CASESENSITIVE) {
|
|
210
222
|
args.push('CASESENSITIVE');
|
|
211
223
|
}
|
|
224
|
+
if (fieldOptions.WITHSUFFIXTRIE) {
|
|
225
|
+
args.push('WITHSUFFIXTRIE');
|
|
226
|
+
}
|
|
212
227
|
break;
|
|
213
228
|
case SchemaFieldTypes.VECTOR:
|
|
214
229
|
args.push(fieldOptions.ALGORITHM);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redis/search",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.1",
|
|
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": "^
|
|
21
|
+
"@types/node": "^18.11.18",
|
|
22
22
|
"nyc": "^15.1.0",
|
|
23
|
-
"release-it": "^15.
|
|
23
|
+
"release-it": "^15.6.0",
|
|
24
24
|
"source-map-support": "^0.5.21",
|
|
25
|
-
"ts-node": "^10.
|
|
26
|
-
"typedoc": "^0.
|
|
27
|
-
"typescript": "^4.
|
|
25
|
+
"ts-node": "^10.9.1",
|
|
26
|
+
"typedoc": "^0.23.24",
|
|
27
|
+
"typescript": "^4.9.4"
|
|
28
28
|
}
|
|
29
29
|
}
|