Package org.apache.lucene.analysis.hunspell

# Class SortingStrategy

java.lang.Object
org.apache.lucene.analysis.hunspell.SortingStrategy

public abstract class SortingStrategy extends Object
The strategy defining how a Hunspell dictionary should be loaded, with different tradeoffs. The entries should be sorted in a special way, and this can be done either in-memory (faster, but temporarily allocating more memory) or using disk (slower, but not needing much memory).

See Also:
  - `offline(Directory, String)`
  - `inMemory()`

## Constructor Summary

Constructors
Constructor
Description
`SortingStrategy()`

## Method Summary

Modifier and Type
Method
Description
`static SortingStrategy`
`inMemory()`
The strategy that loads all entries as `String` objects and sorts them in memory.
`static SortingStrategy`
`offline(Directory tempDir, String tempFileNamePrefix)`
An "offline" strategy that creates temporary files in the given directory and uses them for sorting with `OfflineSorter`.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### SortingStrategy

public SortingStrategy()

## Method Details

### offline

public static SortingStrategy offline(Directory tempDir, String tempFileNamePrefix)
An "offline" strategy that creates temporary files in the given directory and uses them for sorting with `OfflineSorter`. It's slower than `inMemory()`, but doesn't need to load the entire dictionary into memory.

### inMemory

public static SortingStrategy inMemory()
The strategy that loads all entries as `String` objects and sorts them in memory. The entries are then stored in a more compressed way, and the strings are gc-ed, but the loading itself needs `O(dictionary_size)` memory.