Class AutoResumingNodeScoreIterator

java.lang.Object
org.apache.cassandra.utils.AbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
org.apache.cassandra.index.sai.disk.v1.vector.AutoResumingNodeScoreIterator
All Implemented Interfaces:
com.google.common.collect.PeekingIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>, AutoCloseable, Iterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>, CloseableIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>

public class AutoResumingNodeScoreIterator extends AbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
An iterator over SearchResult.NodeScore backed by a SearchResult that resumes search when the backing SearchResult is exhausted.
  • Constructor Details

    • AutoResumingNodeScoreIterator

      public AutoResumingNodeScoreIterator(io.github.jbellis.jvector.graph.GraphSearcher<float[]> searcher, io.github.jbellis.jvector.graph.NeighborSimilarity.ScoreFunction scoreFunction, io.github.jbellis.jvector.graph.NeighborSimilarity.ReRanker<float[]> reRanker, int topK, io.github.jbellis.jvector.util.Bits acceptBits, IntConsumer nodesVisitedConsumer, boolean inMemory, String source, io.github.jbellis.jvector.graph.GraphIndex.View<float[]> view)
      Create a new AutoResumingNodeScoreIterator that iterates over the provided SearchResult. If the SearchResult is consumed, it retrieves the next SearchResult until the search returns no more results.
      Parameters:
      searcher - the GraphSearcher to use to search and resume search.
      nodesVisitedConsumer - a consumer that accepts the total number of nodes visited
      inMemory - whether the graph is in memory or on disk (used for trace logging)
      source - the source of the search (used for trace logging)
      view - the view used to read from disk. It will be closed when the iterator is closed.
  • Method Details

    • computeNext

      protected io.github.jbellis.jvector.graph.SearchResult.NodeScore computeNext()
      Specified by:
      computeNext in class AbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface CloseableIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
      Overrides:
      close in class AbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>