Class: VectorField
Defined in: schema/fields.ts:381
Generic VectorField that supports both FLAT and HNSW algorithms
This is a convenience wrapper that delegates to FlatVectorField or HNSWVectorField based on the algorithm specified. This allows users to write algorithm-agnostic code:
Example
// Generic approach - algorithm specified in attrs
new VectorField('embedding', { algorithm: 'hnsw', dims: 768 })
// Algorithm-specific approach - algorithm implied by class
new HNSWVectorField('embedding', { dims: 768 })
Extends
Constructors
Constructor
new VectorField(
name,attrs):VectorField
Defined in: schema/fields.ts:384
Parameters
name
string
attrs
Returns
VectorField
Overrides
Methods
toRedisField()
toRedisField(
isJson):any
Defined in: schema/fields.ts:398
Convert this field to Redis schema field format. Each subclass must implement this method to return the appropriate Redis field type.
Parameters
isJson
boolean
Whether the index uses JSON storage (affects field naming with $.prefix)
Returns
any
Overrides
Properties
attrs
readonlyattrs:VectorFieldAttrs
Defined in: schema/fields.ts:386
Inherited from
name
readonlyname:string
Defined in: schema/fields.ts:30
Inherited from
path?
optionalpath?:string|null
Defined in: schema/fields.ts:33
Inherited from
type
readonlytype:string
Defined in: schema/fields.ts:31