Sort (Lucene 3.6.2 API)
Keywords: org.apache.lucene.search.suggest.fst.Sort class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.lucene.search.suggest.fst
Class Sort

    java.lang.Object
      org.apache.lucene.search.suggest.fst.Sort

    public final class Sort

extends Object

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:
  `sort(File, File)`
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.

Nested Class Summary
`static class` | `Sort.BufferSize` A bit more descriptive unit for constructors.
`static class` | `Sort.ByteSequencesReader` Utility class to read length-prefixed byte[] entries from an input.
`static class` | `Sort.ByteSequencesWriter` Utility class to emit length-prefixed byte[] entries to an output stream for sorting.
`class` | `Sort.SortInfo` Sort info (debugging mostly).

Field Summary
`static long` | `ABSOLUTE_MIN_SORT_BUFFER_SIZE` Absolute minimum required buffer size for sorting.
`static Comparator<org.apache.lucene.util.BytesRef>` | `DEFAULT_COMPARATOR`
`static long` | `GB`
`static int` | `MAX_TEMPFILES` Maximum number of temporary files before doing an intermediate merge.
`static long` | `MB`
`static long` | `MIN_BUFFER_SIZE_MB` Minimum recommended buffer size for sorting.

Constructor Summary
`Sort()` Defaults constructor.
`Sort(Comparator<org.apache.lucene.util.BytesRef> comparator)`
`Sort(Comparator<org.apache.lucene.util.BytesRef> comparator, Sort.BufferSize ramBufferSize, File tempDirectory, int maxTempfiles)` All-details constructor.

Method Summary
`static File` | `defaultTempDir()` Returns the default temporary directory.
`Comparator<org.apache.lucene.util.BytesRef>` | `getComparator()`
`Sort.SortInfo` | `sort(File input, File output)` Sort input to output, explicit hint for the buffer size.
`protected File` | `sortPartition(int len)` Sort a single partition in-memory.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### MB

    public static final long MB

See Also:
  Constant Field Values

### GB

    public static final long GB

See Also:
  Constant Field Values

### MIN_BUFFER_SIZE_MB

    public static final long MIN_BUFFER_SIZE_MB

  Minimum recommended buffer size for sorting.

  See Also:
    Constant Field Values

### ABSOLUTE_MIN_SORT_BUFFER_SIZE

    public static final long ABSOLUTE_MIN_SORT_BUFFER_SIZE

  Absolute minimum required buffer size for sorting.

  See Also:
    Constant Field Values

### MAX_TEMPFILES

    public static final int MAX_TEMPFILES

  Maximum number of temporary files before doing an intermediate merge.

  See Also:
    Constant Field Values

### DEFAULT_COMPARATOR

    public static final Comparator<org.apache.lucene.util.BytesRef> DEFAULT_COMPARATOR

Constructor Detail

### Sort

    public Sort()
         throws IOException

  Defaults constructor.

  Throws:
    `IOException`
  See Also:
    `defaultTempDir()`, `Sort.BufferSize.automatic()`

### Sort

    public Sort(Comparator<org.apache.lucene.util.BytesRef> comparator)
         throws IOException

Throws:
  `IOException`

### Sort

    public Sort(Comparator<org.apache.lucene.util.BytesRef> comparator,
                Sort.BufferSize ramBufferSize,
                File tempDirectory,
                int maxTempfiles)

  All-details constructor.

Method Detail

### sort

    public Sort.SortInfo sort(File input,
                              File output)
                       throws IOException

  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

    public static File defaultTempDir()
                               throws IOException

  Returns the default temporary directory. By default, java.io.tmpdir. If not accessible or not available, an IOException is thrown

  Throws:
    `IOException`

### sortPartition

    protected File sortPartition(int len)
                          throws IOException

  Sort a single partition in-memory.

  Throws:
    `IOException`

### getComparator

    public Comparator<org.apache.lucene.util.BytesRef> getComparator()

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD