Interface VectorQueryOptions (7.11.0)

Specifies the behavior of the VectorQuery generated by a call to .

Package

@google-cloud/firestore

Properties

distanceMeasure

distanceMeasure: 'EUCLIDEAN' | 'COSINE' | 'DOT_PRODUCT';

Specifies what type of distance is calculated when performing the query.

distanceResultField

distanceResultField?: string | firestore.FieldPath;

Optionally specifies the name of a field that will be set on each returned DocumentSnapshot, which will contain the computed distance for the document.

distanceThreshold

distanceThreshold?: number;

Specifies a threshold for which no less similar documents will be returned. The behavior of the specified distanceMeasure will affect the meaning of the distance threshold.

  • For distanceMeasure: "EUCLIDEAN", the meaning of distanceThreshold is: SELECT docs WHERE euclidean_distance <= distanceThreshold - For distanceMeasure: "COSINE", the meaning of distanceThreshold is: SELECT docs WHERE cosine_distance <= distanceThreshold - For distanceMeasure: "DOT_PRODUCT", the meaning of distanceThreshold is: SELECT docs WHERE dot_product_distance >= distanceThreshold

limit

limit: number;

Specifies the upper bound of documents to return, must be a positive integer with a maximum value of 1000.

queryVector

queryVector: firestore.VectorValue | Array<number>;

The VectorValue used to measure the distance from vectorField values in the documents.

vectorField

vectorField: string | firestore.FieldPath;

A string or FieldPath specifying the vector field to search on.