Share via


VectorizedQuery Class

public final class VectorizedQuery
extends VectorQuery

The query parameters to use for vector search when a raw vector value is provided.

Constructor Summary

Constructor Description
VectorizedQuery(List<Float> vector)

Creates an instance of VectorizedQuery class.

Method Summary

Modifier and Type Method and Description
static VectorizedQuery fromJson(JsonReader jsonReader)

Reads an instance of VectorizedQuery from the JsonReader.

VectorQueryKind getKind()

Get the kind property: The kind of vector query being performed.

List<Float> getVector()

Get the vector property: The vector representation of a search query.

VectorizedQuery setExhaustive(Boolean exhaustive)

Set the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors within the vector index.

VectorizedQuery setFields(String[] fields)

Set the fields property: Vector Fields of type Collection(Edm.Single) to be included in the vector searched.

VectorizedQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)

Set the kNearestNeighborsCount property: Number of nearest neighbors to return as top hits.

VectorizedQuery setOversampling(Double oversampling)

Set the oversampling property: Oversampling factor.

VectorizedQuery setWeight(Float weight)

Set the weight property: Relative weight of the vector query when compared to other vector query and/or the text query within the same search request.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from VectorQuery

Methods inherited from java.lang.Object

Constructor Details

VectorizedQuery

public VectorizedQuery(List<Float> vector)

Creates an instance of VectorizedQuery class.

Parameters:

vector - the vector value to set.

Method Details

fromJson

public static VectorizedQuery fromJson(JsonReader jsonReader)

Reads an instance of VectorizedQuery from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of VectorizedQuery if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If the deserialized JSON object was missing any required properties.

getKind

public VectorQueryKind getKind()

Get the kind property: The kind of vector query being performed.

Overrides:

VectorizedQuery.getKind()

Returns:

the kind value.

getVector

public List<Float> getVector()

Get the vector property: The vector representation of a search query.

Returns:

the vector value.

setExhaustive

public VectorizedQuery setExhaustive(Boolean exhaustive)

Set the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors within the vector index. Useful for scenarios where exact matches are critical, such as determining ground truth values.

Overrides:

VectorizedQuery.setExhaustive(Boolean exhaustive)

Parameters:

exhaustive

setFields

public VectorizedQuery setFields(String[] fields)

Set the fields property: Vector Fields of type Collection(Edm.Single) to be included in the vector searched.

Overrides:

VectorizedQuery.setFields(String[] fields)

Parameters:

fields

setKNearestNeighborsCount

public VectorizedQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)

Set the kNearestNeighborsCount property: Number of nearest neighbors to return as top hits.

Overrides:

VectorizedQuery.setKNearestNeighborsCount(Integer kNearestNeighborsCount)

Parameters:

kNearestNeighborsCount

setOversampling

public VectorizedQuery setOversampling(Double oversampling)

Set the oversampling property: Oversampling factor. Minimum value is 1. It overrides the 'defaultOversampling' parameter configured in the index definition. It can be set only when 'rerankWithOriginalVectors' is true. This parameter is only permitted when a compression method is used on the underlying vector field.

Overrides:

VectorizedQuery.setOversampling(Double oversampling)

Parameters:

oversampling

setWeight

public VectorizedQuery setWeight(Float weight)

Set the weight property: Relative weight of the vector query when compared to other vector query and/or the text query within the same search request. This value is used when combining the results of multiple ranking lists produced by the different vector queries and/or the results retrieved through the text query. The higher the weight, the higher the documents that matched that query will be in the final ranking. Default is 1.0 and the value needs to be a positive number larger than zero.

Overrides:

VectorizedQuery.setWeight(Float weight)

Parameters:

weight

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

VectorizedQuery.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to