topk-js / schema

Functions

binaryVector()

function binaryVector(options: VectorOptions): FieldSpec;
Creates a binary vector field specification. Parameters
ParameterType
optionsVectorOptions
Returns FieldSpec

bool()

function bool(): FieldSpec;
Creates a boolean field specification. Returns FieldSpec

bytes()

function bytes(): FieldSpec;
Creates a bytes field specification. Returns FieldSpec

f32SparseVector()

function f32SparseVector(): FieldSpec;
Creates a 32-bit float sparse vector field specification. Returns FieldSpec

f32Vector()

function f32Vector(options: VectorOptions): FieldSpec;
Creates a 32-bit float vector field specification. Parameters
ParameterType
optionsVectorOptions
Returns FieldSpec

float()

function float(): FieldSpec;
Creates a float field specification. Returns FieldSpec

int()

function int(): FieldSpec;
Creates an integer field specification. Returns FieldSpec

keywordIndex()

function keywordIndex(): FieldIndex;
Creates a keyword index specification. Returns FieldIndex

list()

function list(options: ListOptions): FieldSpec;
Creates a list field specification. Parameters
ParameterType
optionsListOptions
Returns FieldSpec

semanticIndex()

function semanticIndex(options?: SemanticIndexOptions): FieldIndex;
Creates a semantic index specification. Parameters
ParameterType
options?SemanticIndexOptions
Returns FieldIndex

text()

function text(): FieldSpec;
Creates a text field specification. Returns FieldSpec

u8SparseVector()

function u8SparseVector(): FieldSpec;
Creates an 8-bit unsigned integer sparse vector field specification. Returns FieldSpec

u8Vector()

function u8Vector(options: VectorOptions): FieldSpec;
Creates an 8-bit unsigned integer vector field specification. Parameters
ParameterType
optionsVectorOptions
Returns FieldSpec

vectorIndex()

function vectorIndex(options: VectorIndexOptions): FieldIndex;
Creates a vector index specification. Parameters
ParameterType
optionsVectorIndexOptions
Returns FieldIndex

Classes

FieldIndex

Internal

FieldSpec

Internal Methods
index()
index(index: FieldIndex): FieldSpec;
Adds an index configuration to the field. Parameters
ParameterType
indexFieldIndex
Returns FieldSpec
required()
required(): FieldSpec;
Marks the field as required. Returns FieldSpec

Interfaces

ListOptions

Options for list field specifications. This struct contains configuration options for list fields, including the type of values the list can contain. Properties
PropertyTypeDescription
valueTypeListValueTypeThe type of values the list can contain

SemanticIndexOptions

Options for semantic index specifications. This struct contains configuration options for semantic indexes, including the model and embedding type to use. Properties
PropertyTypeDescription
embeddingType?EmbeddingDataTypeThe type of embedding data
model?stringThe embedding model to use

VectorIndexOptions

Options for vector index specifications. This struct contains configuration options for vector indexes, including the distance metric to use. Properties
PropertyTypeDescription
metricVectorDistanceMetricThe distance metric to use for vector similarity

VectorOptions

Options for vector field specifications. This struct contains configuration options for vector fields, including the required dimension parameter. Properties
PropertyTypeDescription
dimensionnumberThe dimension of the vector

Type Aliases

EmbeddingDataType

type EmbeddingDataType = "float32" | "uint8" | "binary";

KeywordIndexType

type KeywordIndexType = "text";

ListValueType

type ListValueType = "text" | "integer" | "float";

VectorDistanceMetric

type VectorDistanceMetric = "cosine" | "euclidean" | "dot_product" | "hamming";