Skip to main content

%SQL.VectorIndex.HNSWIndexer

class %SQL.VectorIndex.HNSWIndexer extends %SQL.VectorIndex.KNNIndexer

Hierarchical Navigable Small World (HNSW), implemented based on https://arxiv.org/abs/1603.09320

Property Inventory

Method Inventory

Parameters

parameter LatestVersion = 2;
Latest graph storage version number

Properties

property M as %Integer (MINVAL = 1);
The number of bi-directional links created for every new element during construction
Property methods: MDisplayToLogical(), MGet(), MIsValid(), MLogicalToDisplay(), MNormalize(), MSet()
property efConstruction as %Integer (MINVAL = 2);
Property methods: efConstructionDisplayToLogical(), efConstructionGet(), efConstructionIsValid(), efConstructionLogicalToDisplay(), efConstructionNormalize(), efConstructionSet()
property efSearch as %Integer (MINVAL = 1);
Property methods: efSearchDisplayToLogical(), efSearchGet(), efSearchIsValid(), efSearchLogicalToDisplay(), efSearchNormalize(), efSearchSet()
property mL as %Double (MINVAL = 0);
A parameter that controls the number of layers in this graph
Property methods: mLDisplayToLogical(), mLGet(), mLIsValid(), mLLogicalToDisplay(), mLNormalize(), mLOdbcToLogical(), mLSet()

Methods

method %OnNew(ClassName, IndexName, Distance, IndexProperty, DIM, IndexData) as %Status
Inherited description: This callback method is invoked by the %New() method to provide notification that a new instance of an object is being created.

If this method returns an error then the object will not be created.

It is passed the arguments provided in the %New call. When customizing this method, override the arguments with whatever variables and types you expect to receive from %New(). For example, if you're going to call %New, passing 2 arguments, %OnNew's signature could be:

Method %OnNew(dob as %Date = "", name as %Name = "") as %Status If instead of returning a %Status code this returns an oref and this oref is a subclass of the current class then this oref will be the one returned to the caller of %New method.

classmethod HNSWrandomLevel(mL)
Return a random positive integer based on the probability distribution described in the HNSW paper (https://arxiv.org/abs/1603.09320). Parameter: mL: controls the shape of the distribution. A larger mL results in more layers in the graph
method getNext(ByRef distance, ByRef id) as %Boolean
Inherited description: Returns by reference the next nearest neighbor to i%Point and the distance between this neighbor to i%Point

Inherited Members

Inherited Properties

Inherited Methods

Subclasses

FeedbackOpens in a new tab