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 class
TopnOrdinalIterator.OrdComparablePair<T extends Comparable<T>>
Pair of ordinal and comparable to use in TopComparableQueueprivate static class
TopnOrdinalIterator.TopComparableQueue<T extends Comparable<T>>
Keeps top N results ordered by Comparable. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ComparableSupplier
<T> private int
private int[]
private final OrdinalIterator
private final int
Fields 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 void
getTopN()
int
nextOrd()
Returns next ord orOrdinalIterator.NO_MORE_ORDS
.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:OrdinalIterator
Returns next ord orOrdinalIterator.NO_MORE_ORDS
. *- Specified by:
nextOrd
in interfaceOrdinalIterator
- Throws:
IOException
-