Record Class ResultEntry

java.lang.Object
java.lang.Record
com.apple.foundationdb.async.common.ResultEntry
Record Components:
primaryKey - Primary key of the item in the HNSW.
vector - The vector that is stored with the item in the structure. This vector is expressed in the client's coordinate system and should be of class HalfRealVector, FloatRealVector, or DoubleRealVector. This member is nullable. It is set to null, if the caller to kNearestNeighborsSearch(.) requested to not return vectors. The vector, if set, may or may not be exactly equal to the vector that was originally inserted into the vector structure. Depending on quantization settings (see Config), the vector that is returned may only be an approximation of the original vector.
additionalValues - additional values that are stored together with the primary key and the vector for faster retrieval.
distance - The distance of item's vector to the query vector.
rankOrRowNumber - The row number of the item. TODO support rank.

public record ResultEntry(@Nonnull Tuple primaryKey, @Nullable RealVector vector, @Nullable Tuple additionalValues, double distance, int rankOrRowNumber) extends Record
Record class that wraps the results of a kNN-search.
  • Constructor Details

    • ResultEntry

      public ResultEntry(@Nonnull Tuple primaryKey, @Nullable RealVector vector, @Nullable Tuple additionalValues, double distance, int rankOrRowNumber)
      Creates an instance of a ResultEntry record class.
      Parameters:
      primaryKey - the value for the primaryKey record component
      vector - the value for the vector record component
      additionalValues - the value for the additionalValues record component
      distance - the value for the distance record component
      rankOrRowNumber - the value for the rankOrRowNumber record component
  • Method Details

    • toString

      @Nonnull public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • primaryKey

      @Nonnull public Tuple primaryKey()
      Returns the value of the primaryKey record component.
      Returns:
      the value of the primaryKey record component
    • vector

      @Nullable public RealVector vector()
      Returns the value of the vector record component.
      Returns:
      the value of the vector record component
    • additionalValues

      @Nullable public Tuple additionalValues()
      Returns the value of the additionalValues record component.
      Returns:
      the value of the additionalValues record component
    • distance

      public double distance()
      Returns the value of the distance record component.
      Returns:
      the value of the distance record component
    • rankOrRowNumber

      public int rankOrRowNumber()
      Returns the value of the rankOrRowNumber record component.
      Returns:
      the value of the rankOrRowNumber record component