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

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

All Implemented Interfaces:
  Closeable, BytesRefSorter

    public class ExternalRefSorter

extends Object
implements BytesRefSorter, Closeable

Builds and iterates over sequences stored on disk.

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
`ExternalRefSorter(Sort sort)` Will buffer all sequences to a temporary file and then sort (all on-disk).

Method Summary
`void` `add(BytesRef utf8)` Adds a single suggestion entry (possibly compound with its bucket).
`void` `close()` Removes any written temporary files.
`Comparator<BytesRef>` `getComparator()`
`BytesRefIterator` `iterator()` Sorts the entries added in `BytesRefSorter.add(BytesRef)` and returns an iterator over all sorted entries.

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

Constructor Detail

### ExternalRefSorter

    public ExternalRefSorter(Sort sort)
                      throws IOException

  Will buffer all sequences to a temporary file and then sort (all on-disk).

  Throws:
    `IOException`

Method Detail

### add

    public void add(BytesRef utf8)
             throws IOException

  Description copied from interface: `BytesRefSorter`
  Adds a single suggestion entry (possibly compound with its bucket).

  Specified by:
    `add` in interface `BytesRefSorter`
  Throws:
    `IOException` - If an I/O exception occurs.

### iterator

    public BytesRefIterator iterator()
                              throws IOException

  Description copied from interface: `BytesRefSorter`
  Sorts the entries added in `BytesRefSorter.add(BytesRef)` and returns an iterator over all sorted entries.

  Specified by:
    `iterator` in interface `BytesRefSorter`
  Throws:
    `IOException` - If an I/O exception occurs.

### close

    public void close()
               throws IOException

  Removes any written temporary files.

  Specified by:
    `close` in interface `Closeable`
  Throws:
    `IOException`

### getComparator

    public Comparator<BytesRef> getComparator()

  Specified by:
    `getComparator` in interface `BytesRefSorter`