Class HnswParameters

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

public final class HnswParameters extends Object implements com.azure.json.JsonSerializable<HnswParameters>
Contains the parameters specific to the HNSW algorithm.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of HnswParameters class.
  • Method Summary

    Modifier and Type
    Method
    Description
    fromJson(com.azure.json.JsonReader jsonReader)
    Reads an instance of HnswParameters from the JsonReader.
    Get the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time.
    Get the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time.
    Get the m property: The number of bi-directional links created for every new element during construction.
    Get the metric property: The similarity metric to use for vector comparisons.
    setEfConstruction(Integer efConstruction)
    Set the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time.
    setEfSearch(Integer efSearch)
    Set the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time.
    Set the m property: The number of bi-directional links created for every new element during construction.
    Set the metric property: The similarity metric to use for vector comparisons.
    com.azure.json.JsonWriter
    toJson(com.azure.json.JsonWriter jsonWriter)

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface com.azure.json.JsonSerializable

    toJson, toJson, toJsonBytes, toJsonString
  • Constructor Details

    • HnswParameters

      public HnswParameters()
      Creates an instance of HnswParameters class.
  • Method Details

    • getM

      public Integer getM()
      Get the m property: The number of bi-directional links created for every new element during construction. Increasing this parameter value may improve recall and reduce retrieval times for datasets with high intrinsic dimensionality at the expense of increased memory consumption and longer indexing time.
      Returns:
      the m value.
    • setM

      public HnswParameters setM(Integer m)
      Set the m property: The number of bi-directional links created for every new element during construction. Increasing this parameter value may improve recall and reduce retrieval times for datasets with high intrinsic dimensionality at the expense of increased memory consumption and longer indexing time.
      Parameters:
      m - the m value to set.
      Returns:
      the HnswParameters object itself.
    • getEfConstruction

      public Integer getEfConstruction()
      Get the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time. Increasing this parameter may improve index quality, at the expense of increased indexing time. At a certain point, increasing this parameter leads to diminishing returns.
      Returns:
      the efConstruction value.
    • setEfConstruction

      public HnswParameters setEfConstruction(Integer efConstruction)
      Set the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time. Increasing this parameter may improve index quality, at the expense of increased indexing time. At a certain point, increasing this parameter leads to diminishing returns.
      Parameters:
      efConstruction - the efConstruction value to set.
      Returns:
      the HnswParameters object itself.
    • getEfSearch

      public Integer getEfSearch()
      Get the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time. Increasing this parameter may improve search results, at the expense of slower search. At a certain point, increasing this parameter leads to diminishing returns.
      Returns:
      the efSearch value.
    • setEfSearch

      public HnswParameters setEfSearch(Integer efSearch)
      Set the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time. Increasing this parameter may improve search results, at the expense of slower search. At a certain point, increasing this parameter leads to diminishing returns.
      Parameters:
      efSearch - the efSearch value to set.
      Returns:
      the HnswParameters object itself.
    • getMetric

      public VectorSearchAlgorithmMetric getMetric()
      Get the metric property: The similarity metric to use for vector comparisons.
      Returns:
      the metric value.
    • setMetric

      public HnswParameters setMetric(VectorSearchAlgorithmMetric metric)
      Set the metric property: The similarity metric to use for vector comparisons.
      Parameters:
      metric - the metric value to set.
      Returns:
      the HnswParameters 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<HnswParameters>
      Throws:
      IOException
    • fromJson

      public static HnswParameters fromJson(com.azure.json.JsonReader jsonReader) throws IOException
      Reads an instance of HnswParameters from the JsonReader.
      Parameters:
      jsonReader - The JsonReader being read.
      Returns:
      An instance of HnswParameters if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.
      Throws:
      IOException - If an error occurs while reading the HnswParameters.