VectorQuery Class
- java.
lang. Object - com.
azure. search. documents. models. VectorQuery
- com.
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 Vector |
Method Summary
| Modifier and Type | Method and Description |
|---|---|
|
static
Vector |
fromJson(JsonReader jsonReader)
Reads an instance of Vector |
| String |
getFields()
Get the fields property: Vector Fields of type Collection(Edm. |
| String |
getFilterOverride()
Get the filter |
|
Vector |
getKind()
Get the kind property: The kind of vector query being performed. |
| Integer |
getKNearestNeighborsCount()
Get the k |
| Double |
getOversampling()
Get the oversampling property: Oversampling factor. |
| Integer |
getPerDocumentVectorLimit()
Get the per |
|
Vector |
getThreshold()
Get the threshold property: The threshold used for vector queries. |
| Float |
getWeight()
Get 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. |
| Boolean |
isExhaustive()
Get the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors within the vector index. |
|
Vector |
setExhaustive(Boolean exhaustive)
Set the exhaustive property: When true, triggers an exhaustive k-nearest neighbor search across all vectors within the vector index. |
|
Vector |
setFields(String[] fields)
Set the fields property: Vector Fields of type Collection(Edm. |
|
Vector |
setFilterOverride(String filterOverride)
Set the filter |
|
Vector |
setKNearestNeighborsCount(Integer kNearestNeighborsCount)
Set the k |
|
Vector |
setOversampling(Double oversampling)
Set the oversampling property: Oversampling factor. |
|
Vector |
setPerDocumentVectorLimit(Integer perDocumentVectorLimit)
Set the per |
|
Vector |
setThreshold(VectorThreshold threshold)
Set the threshold property: The threshold used for vector queries. |
|
Vector |
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. |
|
Json |
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:
Returns:
Throws:
getFields
public String getFields()
Get the fields property: Vector Fields of type Collection(Edm.Single) to be included in the vector searched.
Returns:
getFilterOverride
public String getFilterOverride()
Get the filterOverride property: The OData filter expression to apply to this specific vector query. If no filter expression is defined at the vector level, the expression defined in the top level filter parameter is used instead.
Returns:
getKind
public VectorQueryKind getKind()
Get the kind property: The kind of vector query being performed.
Returns:
getKNearestNeighborsCount
public Integer getKNearestNeighborsCount()
Get the kNearestNeighborsCount property: Number of nearest neighbors to return as top hits.
Returns:
getOversampling
public Double getOversampling()
Get 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.
Returns:
getPerDocumentVectorLimit
public Integer getPerDocumentVectorLimit()
Get the perDocumentVectorLimit property: Controls how many vectors can be matched from each document in a vector search query. Setting it to 1 ensures at most one vector per document is matched, guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple relevant vectors from the same document to be matched. Default is 0.
Returns:
getThreshold
public VectorThreshold getThreshold()
Get the threshold property: The threshold used for vector queries. Note this can only be set if all 'fields' use the same similarity metric.
Returns:
getWeight
public Float getWeight()
Get 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.
Returns:
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:
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:
Returns:
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:
Returns:
setFilterOverride
public VectorQuery setFilterOverride(String filterOverride)
Set the filterOverride property: The OData filter expression to apply to this specific vector query. If no filter expression is defined at the vector level, the expression defined in the top level filter parameter is used instead.
Parameters:
Returns:
setKNearestNeighborsCount
public VectorQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)
Set the kNearestNeighborsCount property: Number of nearest neighbors to return as top hits.
Parameters:
Returns:
setOversampling
public VectorQuery 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.
Parameters:
Returns:
setPerDocumentVectorLimit
public VectorQuery setPerDocumentVectorLimit(Integer perDocumentVectorLimit)
Set the perDocumentVectorLimit property: Controls how many vectors can be matched from each document in a vector search query. Setting it to 1 ensures at most one vector per document is matched, guaranteeing results come from distinct documents. Setting it to 0 (unlimited) allows multiple relevant vectors from the same document to be matched. Default is 0.
Parameters:
Returns:
setThreshold
public VectorQuery setThreshold(VectorThreshold threshold)
Set the threshold property: The threshold used for vector queries. Note this can only be set if all 'fields' use the same similarity metric.
Parameters:
Returns:
setWeight
public VectorQuery 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.
Parameters:
Returns: