VectorizableTextQuery Class

public final class VectorizableTextQuery
extends VectorQuery

The query parameters to use for vector search when a text value that needs to be vectorized is provided.

Constructor Summary

Constructor Description
VectorizableTextQuery(String text)

Creates an instance of VectorizableTextQuery class.

Method Summary

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

Reads an instance of VectorizableTextQuery from the JsonReader.

VectorQueryKind getKind()

Get the kind property: Type of query.

String getText()

Get the text property: The text to be vectorized to perform a vector search query.

VectorizableTextQuery setExhaustive(Boolean exhaustive)

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

VectorizableTextQuery setFields(String fields)

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

VectorizableTextQuery setKNearestNeighbors(Integer kNearestNeighbors)

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

VectorizableTextQuery setOversampling(Double oversampling)

Set the oversampling property: Oversampling factor.

VectorizableTextQuery 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

VectorizableTextQuery

public VectorizableTextQuery(String text)

Creates an instance of VectorizableTextQuery class.

Parameters:

text - the text value to set.

Method Details

fromJson

public static VectorizableTextQuery fromJson(JsonReader jsonReader)

Reads an instance of VectorizableTextQuery from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of VectorizableTextQuery 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: Type of query.

Overrides:

VectorizableTextQuery.getKind()

Returns:

the kind value.

getText

public String getText()

Get the text property: The text to be vectorized to perform a vector search query.

Returns:

the text value.

setExhaustive

public VectorizableTextQuery 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:

VectorizableTextQuery.setExhaustive(Boolean exhaustive)

Parameters:

exhaustive

setFields

public VectorizableTextQuery setFields(String fields)

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

Overrides:

VectorizableTextQuery.setFields(String fields)

Parameters:

fields

setKNearestNeighbors

public VectorizableTextQuery setKNearestNeighbors(Integer kNearestNeighbors)

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

Overrides:

VectorizableTextQuery.setKNearestNeighbors(Integer kNearestNeighbors)

Parameters:

kNearestNeighbors

setOversampling

public VectorizableTextQuery 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:

VectorizableTextQuery.setOversampling(Double oversampling)

Parameters:

oversampling

setWeight

public VectorizableTextQuery 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:

VectorizableTextQuery.setWeight(Float weight)

Parameters:

weight

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Overrides:

VectorizableTextQuery.toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to