@redis/search
Advanced tools
Comparing version 1.1.6 to 1.2.0
@@ -97,3 +97,4 @@ import { RedisCommandArgument, RedisCommandArguments } from '@redis/client/dist/lib/commands'; | ||
export interface AggregateOptions { | ||
VERBATIM?: true; | ||
VERBATIM?: boolean; | ||
ADDSCORES?: boolean; | ||
LOAD?: LoadField | Array<LoadField>; | ||
@@ -100,0 +101,0 @@ STEPS?: Array<GroupByStep | SortStep | ApplyStep | LimitStep | FilterStep>; |
@@ -40,2 +40,5 @@ "use strict"; | ||
} | ||
if (options?.ADDSCORES) { | ||
args.push('ADDSCORES'); | ||
} | ||
if (options?.LOAD) { | ||
@@ -42,0 +45,0 @@ args.push('LOAD'); |
@@ -148,3 +148,4 @@ import * as _LIST from './_LIST'; | ||
TAG = "TAG", | ||
VECTOR = "VECTOR" | ||
VECTOR = "VECTOR", | ||
GEOSHAPE = "GEOSHAPE" | ||
} | ||
@@ -154,7 +155,9 @@ type CreateSchemaField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = T | ({ | ||
AS?: string; | ||
INDEXMISSING?: boolean; | ||
} & E); | ||
type CreateSchemaCommonField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = CreateSchemaField<T, ({ | ||
SORTABLE?: true | 'UNF'; | ||
NOINDEX?: true; | ||
} & E)>; | ||
type CommonFieldArguments = { | ||
SORTABLE?: boolean | 'UNF'; | ||
NOINDEX?: boolean; | ||
}; | ||
type CreateSchemaCommonField<T extends SchemaFieldTypes, E = Record<PropertyKey, unknown>> = CreateSchemaField<T, (CommonFieldArguments & E)>; | ||
export declare enum SchemaTextFieldPhonetics { | ||
@@ -171,2 +174,3 @@ DM_EN = "dm:en", | ||
WITHSUFFIXTRIE?: boolean; | ||
INDEXEMPTY?: boolean; | ||
}>; | ||
@@ -179,2 +183,3 @@ type CreateSchemaNumericField = CreateSchemaCommonField<SchemaFieldTypes.NUMERIC>; | ||
WITHSUFFIXTRIE?: boolean; | ||
INDEXEMPTY?: boolean; | ||
}>; | ||
@@ -200,4 +205,12 @@ export declare enum VectorAlgorithms { | ||
}>; | ||
export declare const SCHEMA_GEO_SHAPE_COORD_SYSTEM: { | ||
readonly SPHERICAL: "SPHERICAL"; | ||
readonly FLAT: "FLAT"; | ||
}; | ||
export type SchemaGeoShapeFieldCoordSystem = typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM[keyof typeof SCHEMA_GEO_SHAPE_COORD_SYSTEM]; | ||
type CreateSchemaGeoShapeField = CreateSchemaCommonField<SchemaFieldTypes.GEOSHAPE, { | ||
COORD_SYSTEM?: SchemaGeoShapeFieldCoordSystem; | ||
}>; | ||
export interface RediSearchSchema { | ||
[field: string]: CreateSchemaTextField | CreateSchemaNumericField | CreateSchemaGeoField | CreateSchemaTagField | CreateSchemaFlatVectorField | CreateSchemaHNSWVectorField; | ||
[field: string]: CreateSchemaTextField | CreateSchemaNumericField | CreateSchemaGeoField | CreateSchemaTagField | CreateSchemaFlatVectorField | CreateSchemaHNSWVectorField | CreateSchemaGeoShapeField; | ||
} | ||
@@ -204,0 +217,0 @@ export declare function pushSchema(args: RedisCommandArguments, schema: RediSearchSchema): void; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.transformProfile = exports.pushSearchOptions = exports.pushParamsArgs = exports.pushSchema = exports.VectorAlgorithms = exports.SchemaTextFieldPhonetics = exports.SchemaFieldTypes = exports.pushArgumentsWithLength = exports.pushSortByArguments = exports.pushSortByProperty = exports.RedisSearchLanguages = void 0; | ||
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; | ||
const _LIST = require("./_LIST"); | ||
@@ -178,3 +178,15 @@ const ALTER = require("./ALTER"); | ||
SchemaFieldTypes["VECTOR"] = "VECTOR"; | ||
SchemaFieldTypes["GEOSHAPE"] = "GEOSHAPE"; | ||
})(SchemaFieldTypes || (exports.SchemaFieldTypes = SchemaFieldTypes = {})); | ||
function pushCommonFieldArguments(args, fieldOptions) { | ||
if (fieldOptions.SORTABLE) { | ||
args.push('SORTABLE'); | ||
if (fieldOptions.SORTABLE === 'UNF') { | ||
args.push('UNF'); | ||
} | ||
} | ||
if (fieldOptions.NOINDEX) { | ||
args.push('NOINDEX'); | ||
} | ||
} | ||
var SchemaTextFieldPhonetics; | ||
@@ -192,2 +204,6 @@ (function (SchemaTextFieldPhonetics) { | ||
})(VectorAlgorithms || (exports.VectorAlgorithms = VectorAlgorithms = {})); | ||
exports.SCHEMA_GEO_SHAPE_COORD_SYSTEM = { | ||
SPHERICAL: 'SPHERICAL', | ||
FLAT: 'FLAT' | ||
}; | ||
function pushSchema(args, schema) { | ||
@@ -218,6 +234,11 @@ for (const [field, fieldOptions] of Object.entries(schema)) { | ||
} | ||
pushCommonFieldArguments(args, fieldOptions); | ||
if (fieldOptions.INDEXEMPTY) { | ||
args.push('INDEXEMPTY'); | ||
} | ||
break; | ||
// case SchemaFieldTypes.NUMERIC: | ||
// case SchemaFieldTypes.GEO: | ||
// break; | ||
case SchemaFieldTypes.NUMERIC: | ||
case SchemaFieldTypes.GEO: | ||
pushCommonFieldArguments(args, fieldOptions); | ||
break; | ||
case SchemaFieldTypes.TAG: | ||
@@ -233,2 +254,6 @@ if (fieldOptions.SEPARATOR) { | ||
} | ||
pushCommonFieldArguments(args, fieldOptions); | ||
if (fieldOptions.INDEXEMPTY) { | ||
args.push('INDEXEMPTY'); | ||
} | ||
break; | ||
@@ -261,13 +286,13 @@ case SchemaFieldTypes.VECTOR: | ||
}); | ||
continue; // vector fields do not contain SORTABLE and NOINDEX options | ||
break; | ||
case SchemaFieldTypes.GEOSHAPE: | ||
if (fieldOptions.COORD_SYSTEM !== undefined) { | ||
args.push('COORD_SYSTEM', fieldOptions.COORD_SYSTEM); | ||
} | ||
pushCommonFieldArguments(args, fieldOptions); | ||
break; | ||
} | ||
if (fieldOptions.SORTABLE) { | ||
args.push('SORTABLE'); | ||
if (fieldOptions.SORTABLE === 'UNF') { | ||
args.push('UNF'); | ||
} | ||
if (fieldOptions.INDEXMISSING) { | ||
args.push('INDEXMISSING'); | ||
} | ||
if (fieldOptions.NOINDEX) { | ||
args.push('NOINDEX'); | ||
} | ||
} | ||
@@ -274,0 +299,0 @@ } |
{ | ||
"name": "@redis/search", | ||
"version": "1.1.6", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "main": "./dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
78720
1960