vector
A Vector query, with the vector specified as a FloatArray.
Vector queries can be ANDed or ORed together to create a compound vector query by passing them to SearchSpec.allOf or SearchSpec.anyOf.
To combine the results of a vector query with the results of a non-vector query, use SearchSpec.mixedMode.
Parameters
The vector to compare against.
The document field to search.
The prefilter query. The server first executes this non-vector query to get an intermediate result. Then it executes the vector query on the intermediate result to get the final result. If no prefilter is specified, the server executes the vector query on all indexed documents.
Samples
// A search specification for a single vector query.
val spec: VectorQuery = SearchSpec.vector("reviews", floatArray)// A search specification for a prefiltered vector query.
// The server first executes the non-vector prefilter query,
// then executes the vector query against the filtered results.
val spec: VectorQuery = SearchSpec.vector(
field = "reviews",
vector = floatArray,
prefilter = SearchSpec.match("pizza"),
)// A search specification that ORs together multiple vector queries.
val spec = SearchSpec.anyOf(
SearchSpec.vector("review", floatArray),
SearchSpec.vector("review", otherFloatArray),
)// A search specification that ORs a non-vector `match` query
// with a vector query.
val spec = SearchSpec.mixedMode(
SearchSpec.match("pizza"),
SearchSpec.vector("review", floatArray),
)A Vector query, with the vector specified as a Base64-encoded sequence of little-endian IEEE 754 floats.
See SearchSpec.vector for more info about vector queries.
Parameters
The vector to compare against, as a Base64-encoded sequence of little-endian IEEE 754 floats.
The document field to search.
The prefilter query. The server first executes this non-vector query to get an intermediate result. Then it executes the vector query on the intermediate result to get the final result. If no prefilter is specified, the server executes the vector query on all indexed documents.