Class VectorQuery (7.9.0)

A query that finds the documents whose vector fields are closest to a certain query vector. Create an instance of VectorQuery with Query.findNearest().

Package

@google-cloud/firestore

Remarks

The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the VectorQuery class.

Properties

query

get query(): Query<AppModelType, DbModelType>;

The query whose results participants in the vector search. Filtering performed by the query will apply before the vector search.

Methods

_getResponse(explainOptions)

_getResponse(explainOptions?: firestore.ExplainOptions): Promise<QueryResponse<VectorQuerySnapshot<AppModelType, DbModelType>>>;
Parameter
Name Description
explainOptions firestore.ExplainOptions
Returns
Type Description
Promise<QueryResponse<VectorQuerySnapshot<AppModelType, DbModelType>>>

explain(options)

explain(options?: firestore.ExplainOptions): Promise<ExplainResults<VectorQuerySnapshot<AppModelType, DbModelType>>>;

Plans and optionally executes this vector search query. Returns a Promise that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).

A Promise that will be resolved with the planner information, statistics from the query execution (if any), and the query results (if any).

Parameter
Name Description
options firestore.ExplainOptions
Returns
Type Description
Promise<ExplainResults<VectorQuerySnapshot<AppModelType, DbModelType>>>

get()

get(): Promise<VectorQuerySnapshot<AppModelType, DbModelType>>;

Executes this vector search query.

Returns
Type Description
Promise<VectorQuerySnapshot<AppModelType, DbModelType>>

A promise that will be resolved with the results of the query.

isEqual(other)

isEqual(other: firestore.VectorQuery<AppModelType, DbModelType>): boolean;

Compares this object with the given object for equality.

This object is considered "equal" to the other object if and only if other performs the same vector distance search as this VectorQuery and the underlying Query of other compares equal to that of this object using Query.isEqual().

Parameter
Name Description
other FirebaseFirestore.VectorQuery<AppModelType, DbModelType>

The object to compare to this object for equality.

Returns
Type Description
boolean

true if this object is "equal" to the given object, as defined above, or false otherwise.