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 Summary
ConstructorsConstructorDescriptionAutoResumingNodeScoreIterator(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 newAutoResumingNodeScoreIteratorthat iterates over the providedSearchResult. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected io.github.jbellis.jvector.graph.SearchResult.NodeScoreMethods inherited from class org.apache.cassandra.utils.AbstractIterator
endOfData, hasNext, next, peek, removeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Iterator
forEachRemaining
-
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 newAutoResumingNodeScoreIteratorthat iterates over the providedSearchResult. If theSearchResultis consumed, it retrieves the nextSearchResultuntil the search returns no more results.- Parameters:
searcher- theGraphSearcherto use to search and resume search.nodesVisitedConsumer- a consumer that accepts the total number of nodes visitedinMemory- 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:
computeNextin classAbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
-
close
public void close()- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseableIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>- Overrides:
closein classAbstractIterator<io.github.jbellis.jvector.graph.SearchResult.NodeScore>
-