Package org.apache.lucene.search.suggest
Class InMemorySorter
- java.lang.Object
-
- org.apache.lucene.search.suggest.InMemorySorter
-
- All Implemented Interfaces:
BytesRefSorter
public final class InMemorySorter extends Object implements BytesRefSorter
AnBytesRefSorter
that keeps all the entries in memory.- WARNING: This API is experimental and might change in incompatible ways in the next release.
- NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.
-
-
Constructor Summary
Constructors Constructor Description InMemorySorter(Comparator<BytesRef> comparator)
Creates an InMemorySorter, sorting entries by the provided comparator.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(BytesRef utf8)
Adds a single suggestion entry (possibly compound with its bucket).Comparator<BytesRef>
getComparator()
Comparator used to determine the sort order of entries.BytesRefIterator
iterator()
Sorts the entries added inBytesRefSorter.add(BytesRef)
and returns an iterator over all sorted entries.
-
-
-
Constructor Detail
-
InMemorySorter
public InMemorySorter(Comparator<BytesRef> comparator)
Creates an InMemorySorter, sorting entries by the provided comparator.
-
-
Method Detail
-
add
public void add(BytesRef utf8)
Description copied from interface:BytesRefSorter
Adds a single suggestion entry (possibly compound with its bucket).- Specified by:
add
in interfaceBytesRefSorter
-
iterator
public BytesRefIterator iterator()
Description copied from interface:BytesRefSorter
Sorts the entries added inBytesRefSorter.add(BytesRef)
and returns an iterator over all sorted entries.- Specified by:
iterator
in interfaceBytesRefSorter
-
getComparator
public Comparator<BytesRef> getComparator()
Description copied from interface:BytesRefSorter
Comparator used to determine the sort order of entries.- Specified by:
getComparator
in interfaceBytesRefSorter
-
-