Module org.apache.lucene.sandbox
Class TopnOrdinalIterator<T extends Comparable<T>>
java.lang.Object
org.apache.lucene.sandbox.facet.iterators.TopnOrdinalIterator<T>
- All Implemented Interfaces:
OrdinalIterator
public final class TopnOrdinalIterator<T extends Comparable<T>>
extends Object
implements OrdinalIterator
Class that consumes incoming ordinals, sorts them by provided Comparable, and returns first top N
ordinals only.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classTopnOrdinalIterator.OrdComparablePair<T extends Comparable<T>>Pair of ordinal and comparable to use in TopComparableQueueprivate static classTopnOrdinalIterator.TopComparableQueue<T extends Comparable<T>>Keeps top N results ordered by Comparable. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComparableSupplier<T> private intprivate int[]private final OrdinalIteratorprivate final intFields inherited from interface org.apache.lucene.sandbox.facet.iterators.OrdinalIterator
EMPTY, NO_MORE_ORDS -
Constructor Summary
ConstructorsConstructorDescriptionTopnOrdinalIterator(OrdinalIterator sourceOrds, ComparableSupplier<T> comparableSupplier, int topN) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprivate voidgetTopN()intnextOrd()Returns next ord orOrdinalIterator.NO_MORE_ORDS.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.lucene.sandbox.facet.iterators.OrdinalIterator
toArray
-
Field Details
-
comparableSupplier
-
sourceOrds
-
topN
private final int topN -
result
private int[] result -
currentIndex
private int currentIndex
-
-
Constructor Details
-
TopnOrdinalIterator
public TopnOrdinalIterator(OrdinalIterator sourceOrds, ComparableSupplier<T> comparableSupplier, int topN) Constructor.
-
-
Method Details
-
getTopN
- Throws:
IOException
-
nextOrd
Description copied from interface:OrdinalIteratorReturns next ord orOrdinalIterator.NO_MORE_ORDS. *- Specified by:
nextOrdin interfaceOrdinalIterator- Throws:
IOException
-