VectorQuery

A vector search (SPEC.md §11.3): the k visible documents whose vectors are nearest to vector under the store's VectorField.metric, nearest first, in a store with a CreationOptions.vectorField.

Queries are values: two instances with the same settings, the vector's numbers compared bit by bit, are equal, and copy derives a variant. Throws IllegalArgumentException for an empty vector, a number that isn't finite, a k outside 1..MAX_K and a maxDistance that is NaN.

Constructors

Link copied to clipboard
constructor(vector: FloatArray, k: Int = 10, maxDistance: Float? = null, scan: ScanPolicy = ScanPolicy.REJECT)

The k documents nearest to vector, within maxDistance when it's given.

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

How many numbers the query vector has, which must be the vector field's dimensions.

Link copied to clipboard

The condition a document has to meet to be a candidate (SPEC.md §10.5), or null for every document with a vector. A comparison of one of its root's members with a literal is an index term that narrows the candidates; a filter without one needs scan to be ScanPolicy.ALLOW_SCAN.

Link copied to clipboard
val k: Int
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

A copy of the query vector.

Functions

Link copied to clipboard
fun copy(vector: FloatArray = this.values, k: Int = this.k, maxDistance: Float? = this.maxDistance, scan: ScanPolicy = this.scan): VectorQuery

This query with the given settings changed, the documentFilter kept; the result is validated like a new instance.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String

Names the query vector by its dimensions only: it has up to 4,096 numbers.

Link copied to clipboard

This query with documentFilter set to filter, or removed with null.