Module org.elasticsearch.server
Class PrefetchingCentroidIterator
java.lang.Object
org.elasticsearch.index.codec.vectors.diskbbq.PrefetchingCentroidIterator
- All Implemented Interfaces:
CentroidIterator
A configurable iterator that prefetches posting lists ahead of consumption
to optimize disk I/O performance. This iterator wraps another CentroidIterator
and maintains a configurable buffer of prefetched posting list locations.
The iterator is not thread-safe and is designed for single-threaded access.
-
Constructor Summary
ConstructorsConstructorDescriptionPrefetchingCentroidIterator(CentroidIterator delegate, org.apache.lucene.store.IndexInput postingListSlice) Creates a prefetching iterator with default prefetch depth of 1.PrefetchingCentroidIterator(CentroidIterator delegate, org.apache.lucene.store.IndexInput postingListSlice, int prefetchAhead) Creates a prefetching iterator with configurable prefetch depth. -
Method Summary
-
Constructor Details
-
PrefetchingCentroidIterator
public PrefetchingCentroidIterator(CentroidIterator delegate, org.apache.lucene.store.IndexInput postingListSlice) throws IOException Creates a prefetching iterator with default prefetch depth of 1.- Parameters:
delegate- the underlying centroid iteratorpostingListSlice- the index input for posting lists- Throws:
IOException- if prefetching fails during initialization
-
PrefetchingCentroidIterator
public PrefetchingCentroidIterator(CentroidIterator delegate, org.apache.lucene.store.IndexInput postingListSlice, int prefetchAhead) throws IOException Creates a prefetching iterator with configurable prefetch depth.- Parameters:
delegate- the underlying centroid iteratorpostingListSlice- the index input for posting listsprefetchAhead- number of posting lists to prefetch ahead (must be >= 1)- Throws:
IOException- if prefetching fails during initializationIllegalArgumentException- ifprefetchAhead < 1
-
-
Method Details
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceCentroidIterator
-
nextPosting
- Specified by:
nextPostingin interfaceCentroidIterator- Throws:
IOException
-