@redis/search 1.1.5 → 1.2.0
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/dist/commands/AGGREGATE.d.ts +2 -1
- package/dist/commands/AGGREGATE.js +3 -0
- package/dist/commands/index.d.ts +19 -6
- package/dist/commands/index.js +38 -13
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/package.json +1 -1
|
@@ -94,7 +94,8 @@ type LoadField = PropertyName | {
|
|
|
94
94
|
AS?: string;
|
|
95
95
|
};
|
|
96
96
|
export interface AggregateOptions {
|
|
97
|
-
VERBATIM?:
|
|
97
|
+
VERBATIM?: boolean;
|
|
98
|
+
ADDSCORES?: boolean;
|
|
98
99
|
LOAD?: LoadField | Array<LoadField>;
|
|
99
100
|
STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>;
|
|
100
101
|
PARAMS?: Params;
|
|
@@ -37,6 +37,9 @@ function pushAggregatehOptions(args, options) {
|
|
|
37
37
|
if (options?.VERBATIM) {
|
|
38
38
|
args.push('VERBATIM');
|
|
39
39
|
}
|
|
40
|
+
if (options?.ADDSCORES) {
|
|
41
|
+
args.push('ADDSCORES');
|
|
42
|
+
}
|
|
40
43
|
if (options?.LOAD) {
|
|
41
44
|
args.push('LOAD');
|
|
42
45
|
(0, _1.pushArgumentsWithLength)(args, () => {
|
package/dist/commands/index.d.ts
CHANGED
|
@@ -145,16 +145,19 @@ export declare enum SchemaFieldTypes {
|
|
|
145
145
|
NUMERIC = "NUMERIC",
|
|
146
146
|
GEO = "GEO",
|
|
147
147
|
TAG = "TAG",
|
|
148
|
-
VECTOR = "VECTOR"
|
|
148
|
+
VECTOR = "VECTOR",
|
|
149
|
+
GEOSHAPE = "GEOSHAPE"
|
|
149
150
|
}
|
|
150
151
|
type CreateSchemaField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = T | ({
|
|
151
152
|
type: T;
|
|
152
153
|
AS?: string;
|
|
154
|
+
INDEXMISSING?: boolean;
|
|
153
155
|
} & E);
|
|
154
|
-
type
|
|
155
|
-
SORTABLE?:
|
|
156
|
-
NOINDEX?:
|
|
157
|
-
}
|
|
156
|
+
type CommonFieldArguments = {
|
|
157
|
+
SORTABLE?: boolean | 'UNF';
|
|
158
|
+
NOINDEX?: boolean;
|
|
159
|
+
};
|
|
160
|
+
type CreateSchemaCommonField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = CreateSchemaField<T, (CommonFieldArguments & E)>;
|
|
158
161
|
export declare enum SchemaTextFieldPhonetics {
|
|
159
162
|
DM_EN = "dm:en",
|
|
160
163
|
DM_FR = "dm:fr",
|
|
@@ -166,6 +169,7 @@ type CreateSchemaTextField = CreateSchemaCommonField<SchemaFieldTypes.TEXT, {
|
|
|
166
169
|
WEIGHT?: number;
|
|
167
170
|
PHONETIC?: SchemaTextFieldPhonetics;
|
|
168
171
|
WITHSUFFIXTRIE?: boolean;
|
|
172
|
+
INDEXEMPTY?: boolean;
|
|
169
173
|
}>;
|
|
170
174
|
type CreateSchemaNumericField = CreateSchemaCommonField<SchemaFieldTypes.NUMERIC>;
|
|
171
175
|
type CreateSchemaGeoField = CreateSchemaCommonField<SchemaFieldTypes.GEO>;
|
|
@@ -173,6 +177,7 @@ type CreateSchemaTagField = CreateSchemaCommonField<SchemaFieldTypes.TAG, {
|
|
|
173
177
|
SEPARATOR?: string;
|
|
174
178
|
CASESENSITIVE?: true;
|
|
175
179
|
WITHSUFFIXTRIE?: boolean;
|
|
180
|
+
INDEXEMPTY?: boolean;
|
|
176
181
|
}>;
|
|
177
182
|
export declare enum VectorAlgorithms {
|
|
178
183
|
FLAT = "FLAT",
|
|
@@ -193,8 +198,16 @@ type CreateSchemaHNSWVectorField = CreateSchemaVectorField<VectorAlgorithms.HNSW
|
|
|
193
198
|
EF_CONSTRUCTION?: number;
|
|
194
199
|
EF_RUNTIME?: number;
|
|
195
200
|
}>;
|
|
201
|
+
export declare const SCHEMA_GEO_SHAPE_COORD_SYSTEM: {
|
|
202
|
+
readonly SPHERICAL: "SPHERICAL";
|
|
203
|
+
readonly FLAT: "FLAT";
|
|
204
|
+
};
|
|
205
|
+
export type SchemaGeoShapeFieldCoordSystem = typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM[keyof typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM];
|
|
206
|
+
type CreateSchemaGeoShapeField = CreateSchemaCommonField<SchemaFieldTypes.GEOSHAPE, {
|
|
207
|
+
COORD_SYSTEM?: SchemaGeoShapeFieldCoordSystem;
|
|
208
|
+
}>;
|
|
196
209
|
export interface RediSearchSchema {
|
|
197
|
-
[field: string]: CreateSchemaTextField | CreateSchemaNumericField | CreateSchemaGeoField | CreateSchemaTagField | CreateSchemaFlatVectorField | CreateSchemaHNSWVectorField;
|
|
210
|
+
[field: string]: CreateSchemaTextField | CreateSchemaNumericField | CreateSchemaGeoField | CreateSchemaTagField | CreateSchemaFlatVectorField | CreateSchemaHNSWVectorField | CreateSchemaGeoShapeField;
|
|
198
211
|
}
|
|
199
212
|
export declare function pushSchema(args: RedisCommandArguments, schema: RediSearchSchema): void;
|
|
200
213
|
export type Params = Record<string, RedisCommandArgument | number>;
|
package/dist/commands/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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;
|
|
3
|
+
exports.transformProfile = exports.pushSearchOptions = exports.pushParamsArgs = exports.pushSchema = exports.SCHEMA_GEO_SHAPE_COORD_SYSTEM = 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
6
|
const AGGREGATE_WITHCURSOR = require("./AGGREGATE_WITHCURSOR");
|
|
@@ -175,7 +175,19 @@ var SchemaFieldTypes;
|
|
|
175
175
|
SchemaFieldTypes["GEO"] = "GEO";
|
|
176
176
|
SchemaFieldTypes["TAG"] = "TAG";
|
|
177
177
|
SchemaFieldTypes["VECTOR"] = "VECTOR";
|
|
178
|
+
SchemaFieldTypes["GEOSHAPE"] = "GEOSHAPE";
|
|
178
179
|
})(SchemaFieldTypes || (exports.SchemaFieldTypes = SchemaFieldTypes = {}));
|
|
180
|
+
function pushCommonFieldArguments(args, fieldOptions) {
|
|
181
|
+
if (fieldOptions.SORTABLE) {
|
|
182
|
+
args.push('SORTABLE');
|
|
183
|
+
if (fieldOptions.SORTABLE === 'UNF') {
|
|
184
|
+
args.push('UNF');
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (fieldOptions.NOINDEX) {
|
|
188
|
+
args.push('NOINDEX');
|
|
189
|
+
}
|
|
190
|
+
}
|
|
179
191
|
var SchemaTextFieldPhonetics;
|
|
180
192
|
(function (SchemaTextFieldPhonetics) {
|
|
181
193
|
SchemaTextFieldPhonetics["DM_EN"] = "dm:en";
|
|
@@ -188,6 +200,10 @@ var VectorAlgorithms;
|
|
|
188
200
|
VectorAlgorithms["FLAT"] = "FLAT";
|
|
189
201
|
VectorAlgorithms["HNSW"] = "HNSW";
|
|
190
202
|
})(VectorAlgorithms || (exports.VectorAlgorithms = VectorAlgorithms = {}));
|
|
203
|
+
exports.SCHEMA_GEO_SHAPE_COORD_SYSTEM = {
|
|
204
|
+
SPHERICAL: 'SPHERICAL',
|
|
205
|
+
FLAT: 'FLAT'
|
|
206
|
+
};
|
|
191
207
|
function pushSchema(args, schema) {
|
|
192
208
|
for (const [field, fieldOptions] of Object.entries(schema)) {
|
|
193
209
|
args.push(field);
|
|
@@ -213,10 +229,15 @@ function pushSchema(args, schema) {
|
|
|
213
229
|
if (fieldOptions.WITHSUFFIXTRIE) {
|
|
214
230
|
args.push('WITHSUFFIXTRIE');
|
|
215
231
|
}
|
|
232
|
+
pushCommonFieldArguments(args, fieldOptions);
|
|
233
|
+
if (fieldOptions.INDEXEMPTY) {
|
|
234
|
+
args.push('INDEXEMPTY');
|
|
235
|
+
}
|
|
236
|
+
break;
|
|
237
|
+
case SchemaFieldTypes.NUMERIC:
|
|
238
|
+
case SchemaFieldTypes.GEO:
|
|
239
|
+
pushCommonFieldArguments(args, fieldOptions);
|
|
216
240
|
break;
|
|
217
|
-
// case SchemaFieldTypes.NUMERIC:
|
|
218
|
-
// case SchemaFieldTypes.GEO:
|
|
219
|
-
// break;
|
|
220
241
|
case SchemaFieldTypes.TAG:
|
|
221
242
|
if (fieldOptions.SEPARATOR) {
|
|
222
243
|
args.push('SEPARATOR', fieldOptions.SEPARATOR);
|
|
@@ -227,6 +248,10 @@ function pushSchema(args, schema) {
|
|
|
227
248
|
if (fieldOptions.WITHSUFFIXTRIE) {
|
|
228
249
|
args.push('WITHSUFFIXTRIE');
|
|
229
250
|
}
|
|
251
|
+
pushCommonFieldArguments(args, fieldOptions);
|
|
252
|
+
if (fieldOptions.INDEXEMPTY) {
|
|
253
|
+
args.push('INDEXEMPTY');
|
|
254
|
+
}
|
|
230
255
|
break;
|
|
231
256
|
case SchemaFieldTypes.VECTOR:
|
|
232
257
|
args.push(fieldOptions.ALGORITHM);
|
|
@@ -254,16 +279,16 @@ function pushSchema(args, schema) {
|
|
|
254
279
|
break;
|
|
255
280
|
}
|
|
256
281
|
});
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
args
|
|
263
|
-
|
|
282
|
+
break;
|
|
283
|
+
case SchemaFieldTypes.GEOSHAPE:
|
|
284
|
+
if (fieldOptions.COORD_SYSTEM !== undefined) {
|
|
285
|
+
args.push('COORD_SYSTEM', fieldOptions.COORD_SYSTEM);
|
|
286
|
+
}
|
|
287
|
+
pushCommonFieldArguments(args, fieldOptions);
|
|
288
|
+
break;
|
|
264
289
|
}
|
|
265
|
-
if (fieldOptions.
|
|
266
|
-
args.push('
|
|
290
|
+
if (fieldOptions.INDEXMISSING) {
|
|
291
|
+
args.push('INDEXMISSING');
|
|
267
292
|
}
|
|
268
293
|
}
|
|
269
294
|
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { default } from './commands';
|
|
2
|
-
export { RediSearchSchema, SchemaFieldTypes, SchemaTextFieldPhonetics, SearchReply, VectorAlgorithms } from './commands';
|
|
3
|
-
export {
|
|
2
|
+
export { RediSearchSchema, RedisSearchLanguages, SchemaFieldTypes, SchemaTextFieldPhonetics, SearchReply, VectorAlgorithms } from './commands';
|
|
3
|
+
export { AggregateGroupByReducers, AggregateSteps } from './commands/AGGREGATE';
|
|
4
4
|
export { SearchOptions } from './commands/SEARCH';
|
package/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.AggregateSteps = exports.AggregateGroupByReducers = exports.VectorAlgorithms = exports.SchemaTextFieldPhonetics = exports.SchemaFieldTypes = exports.RedisSearchLanguages = exports.default = void 0;
|
|
4
4
|
var commands_1 = require("./commands");
|
|
5
5
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return commands_1.default; } });
|
|
6
6
|
var commands_2 = require("./commands");
|
|
7
|
+
Object.defineProperty(exports, "RedisSearchLanguages", { enumerable: true, get: function () { return commands_2.RedisSearchLanguages; } });
|
|
7
8
|
Object.defineProperty(exports, "SchemaFieldTypes", { enumerable: true, get: function () { return commands_2.SchemaFieldTypes; } });
|
|
8
9
|
Object.defineProperty(exports, "SchemaTextFieldPhonetics", { enumerable: true, get: function () { return commands_2.SchemaTextFieldPhonetics; } });
|
|
9
10
|
Object.defineProperty(exports, "VectorAlgorithms", { enumerable: true, get: function () { return commands_2.VectorAlgorithms; } });
|
|
10
11
|
var AGGREGATE_1 = require("./commands/AGGREGATE");
|
|
11
|
-
Object.defineProperty(exports, "AggregateSteps", { enumerable: true, get: function () { return AGGREGATE_1.AggregateSteps; } });
|
|
12
12
|
Object.defineProperty(exports, "AggregateGroupByReducers", { enumerable: true, get: function () { return AGGREGATE_1.AggregateGroupByReducers; } });
|
|
13
|
+
Object.defineProperty(exports, "AggregateSteps", { enumerable: true, get: function () { return AGGREGATE_1.AggregateSteps; } });
|