Class VectorizableTextQuery

java.lang.Object
com.azure.search.documents.models.VectorQuery
com.azure.search.documents.models.VectorizableTextQuery
All Implemented Interfaces:
com.azure.json.JsonSerializable<VectorQuery>

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 Details

    • VectorizableTextQuery

      public VectorizableTextQuery(String text)
      Creates an instance of VectorizableTextQuery class.
      Parameters:
      text - the text value to set.
  • Method Details

    • getKind

      public VectorQueryKind getKind()
      Get the kind property: The kind of vector query being performed.
      Overrides:
      getKind in class VectorQuery
      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.
    • getQueryRewrites

      public QueryRewrites getQueryRewrites()
      Get the queryRewrites property: Can be configured to let a generative model rewrite the query before sending it to be vectorized.
      Returns:
      the queryRewrites value.
    • setQueryRewrites

      public VectorizableTextQuery setQueryRewrites(QueryRewrites queryRewrites)
      Set the queryRewrites property: Can be configured to let a generative model rewrite the query before sending it to be vectorized.
      Parameters:
      queryRewrites - the queryRewrites value to set.
      Returns:
      the VectorizableTextQuery object itself.
    • setKNearestNeighborsCount

      public VectorizableTextQuery setKNearestNeighborsCount(Integer kNearestNeighborsCount)
      Set the kNearestNeighborsCount property: Number of nearest neighbors to return as top hits.
      Overrides:
      setKNearestNeighborsCount in class VectorQuery
      Parameters:
      kNearestNeighborsCount - the kNearestNeighborsCount value to set.
      Returns:
      the VectorQuery object itself.
    • 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:
      setFields in class VectorQuery
      Parameters:
      fields - the fields value to set.
      Returns:
      the VectorQuery object itself.
    • 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:
      setExhaustive in class VectorQuery
      Parameters:
      exhaustive - the exhaustive value to set.
      Returns:
      the VectorQuery object itself.
    • 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:
      setOversampling in class VectorQuery
      Parameters:
      oversampling - the oversampling value to set.
      Returns:
      the VectorQuery object itself.
    • 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:
      setWeight in class VectorQuery
      Parameters:
      weight - the weight value to set.
      Returns:
      the VectorQuery object itself.
    • setThreshold

      public VectorizableTextQuery 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.
      Overrides:
      setThreshold in class VectorQuery
      Parameters:
      threshold - the threshold value to set.
      Returns:
      the VectorQuery object itself.
    • setFilterOverride

      public VectorizableTextQuery 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.
      Overrides:
      setFilterOverride in class VectorQuery
      Parameters:
      filterOverride - the filterOverride value to set.
      Returns:
      the VectorQuery object itself.
    • toJson

      public com.azure.json.JsonWriter toJson(com.azure.json.JsonWriter jsonWriter) throws IOException
      Specified by:
      toJson in interface com.azure.json.JsonSerializable<VectorQuery>
      Overrides:
      toJson in class VectorQuery
      Throws:
      IOException
    • fromJson

      public static VectorizableTextQuery fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      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:
      IllegalStateException - If the deserialized JSON object was missing any required properties.
      IOException - If an error occurs while reading the VectorizableTextQuery.