Share via


VectorQuery Class

  • java.lang.Object
    • com.azure.search.documents.models.VectorQuery

Implements

public class VectorQuery
implements JsonSerializable<VectorQuery>

The query parameters for vector and hybrid search queries.

Constructor Summary

Constructor Description
VectorQuery()

Creates an instance of VectorQuery class.

Method Summary

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

Reads an instance of VectorQuery from the JsonReader.

String getFields()

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

Integer getKNearestNeighborsCount()

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

Boolean isExhaustive()

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

VectorQuery setExhaustive(Boolean exhaustive)

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

VectorQuery setFields(String[] fields)

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

VectorQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)

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

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

VectorQuery

public VectorQuery()

Creates an instance of VectorQuery class.

Method Details

fromJson

public static VectorQuery fromJson(JsonReader jsonReader)

Reads an instance of VectorQuery from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of VectorQuery 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 the polymorphic discriminator.

getFields

public String getFields()

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

Returns:

the fields value.

getKNearestNeighborsCount

public Integer getKNearestNeighborsCount()

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

Returns:

the kNearestNeighborsCount value.

isExhaustive

public Boolean isExhaustive()

Get 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.

Returns:

the exhaustive value.

setExhaustive

public VectorQuery 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.

Parameters:

exhaustive - the exhaustive value to set.

Returns:

the VectorQuery object itself.

setFields

public VectorQuery setFields(String[] fields)

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

Parameters:

fields - the fields value to set.

Returns:

the VectorQuery object itself.

setKNearestNeighborsCount

public VectorQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)

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

Parameters:

kNearestNeighborsCount - the kNearestNeighborsCount value to set.

Returns:

the VectorQuery object itself.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to