Share via


HnswParameters Class

  • java.lang.Object
    • com.azure.search.documents.indexes.models.HnswParameters

Implements

public final class HnswParameters
implements JsonSerializable<HnswParameters>

Contains the parameters specific to the HNSW algorithm.

Constructor Summary

Constructor Description
HnswParameters()

Creates an instance of HnswParameters class.

Method Summary

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

Reads an instance of HnswParameters from the JsonReader.

Integer getEfConstruction()

Get the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time.

Integer getEfSearch()

Get the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time.

Integer getM()

Get the m property: The number of bi-directional links created for every new element during construction.

VectorSearchAlgorithmMetric getMetric()

Get the metric property: The similarity metric to use for vector comparisons.

HnswParameters setEfConstruction(Integer efConstruction)

Set the efConstruction property: The size of the dynamic list containing the nearest neighbors, which is used during index time.

HnswParameters setEfSearch(Integer efSearch)

Set the efSearch property: The size of the dynamic list containing the nearest neighbors, which is used during search time.

HnswParameters setM(Integer m)

Set the m property: The number of bi-directional links created for every new element during construction.

HnswParameters setMetric(VectorSearchAlgorithmMetric metric)

Set the metric property: The similarity metric to use for vector comparisons.

JsonWriter toJson(JsonWriter jsonWriter)

Methods inherited from java.lang.Object

Constructor Details

HnswParameters

public HnswParameters()

Creates an instance of HnswParameters class.

Method Details

fromJson

public static HnswParameters fromJson(JsonReader jsonReader)

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.

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.

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.

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.

getMetric

public VectorSearchAlgorithmMetric getMetric()

Get the metric property: The similarity metric to use for vector comparisons.

Returns:

the metric 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.

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.

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.

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 JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

Applies to