Package org.apache.lucene.search.suggest
Class Sort
java.lang.Object
org.apache.lucene.search.suggest.Sort
On-disk sorting of byte arrays. Each byte array (entry) is a composed of the following
fields:
- (two bytes) length of the following byte array,
- exactly the above count of bytes for the sequence to be sorted.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA bit more descriptive unit for constructors.static classUtility class to read length-prefixed byte[] entries from an input.static classUtility class to emit length-prefixed byte[] entries to an output stream for sorting.classSort info (debugging mostly). -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longAbsolute minimum required buffer size for sorting.static final Comparator<BytesRef> Default comparator: sorts in binary (codepoint) orderstatic final longConvenience constant for gigabytesstatic final intMaximum number of temporary files before doing an intermediate merge.static final longConvenience constant for megabytesstatic final longMinimum recommended buffer size for sorting. -
Constructor Summary
ConstructorsConstructorDescriptionSort()Defaults constructor.Sort(Comparator<BytesRef> comparator) Defaults constructor with a custom comparator.Sort(Comparator<BytesRef> comparator, Sort.BufferSize ramBufferSize, File tempDirectory, int maxTempfiles) All-details constructor. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileReturns the default temporary directory.Returns the comparator in use to sort entriesSort input to output, explicit hint for the buffer size.
-
Field Details
-
MB
public static final long MBConvenience constant for megabytes- See Also:
-
GB
public static final long GBConvenience constant for gigabytes- See Also:
-
MIN_BUFFER_SIZE_MB
public static final long MIN_BUFFER_SIZE_MBMinimum recommended buffer size for sorting.- See Also:
-
ABSOLUTE_MIN_SORT_BUFFER_SIZE
public static final long ABSOLUTE_MIN_SORT_BUFFER_SIZEAbsolute minimum required buffer size for sorting.- See Also:
-
MAX_TEMPFILES
public static final int MAX_TEMPFILESMaximum number of temporary files before doing an intermediate merge.- See Also:
-
DEFAULT_COMPARATOR
Default comparator: sorts in binary (codepoint) order
-
-
Constructor Details
-
Sort
Defaults constructor.- Throws:
IOException- See Also:
-
Sort
Defaults constructor with a custom comparator.- Throws:
IOException- See Also:
-
Sort
public Sort(Comparator<BytesRef> comparator, Sort.BufferSize ramBufferSize, File tempDirectory, int maxTempfiles) All-details constructor.
-
-
Method Details
-
sort
Sort input to output, explicit hint for the buffer size. The amount of allocated memory may deviate from the hint (may be smaller or larger).- Throws:
IOException
-
defaultTempDir
Returns the default temporary directory. By default, java.io.tmpdir. If not accessible or not available, an IOException is thrown- Throws:
IOException
-
getComparator
Returns the comparator in use to sort entries
-