AbstractLuceneSpellChecker (Solr 3.6.2 API)
Keywords: org.apache.solr.spelling.AbstractLuceneSpellChecker 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.solr.spelling
Class AbstractLuceneSpellChecker

    java.lang.Object
      org.apache.solr.spelling.SolrSpellChecker
          org.apache.solr.spelling.AbstractLuceneSpellChecker

Direct Known Subclasses:
  FileBasedSpellChecker, IndexBasedSpellChecker

    public abstract class AbstractLuceneSpellChecker

extends SolrSpellChecker

Abstract base class for all Lucene-based spell checking implementations.

Refer to SpellCheckComponent for more details.

Since:
  solr 1.3

Field Summary
`protected float` | `accuracy`
`static String` | `ACCURACY`
`static String` | `COMPARATOR_CLASS`
`static int` | `DEFAULT_SUGGESTION_COUNT`
`protected Dictionary` | `dictionary`
`static String` | `FIELD`
`static String` | `FREQ_COMP`
`protected Directory` | `index`
`static String` | `INDEX_DIR`
`protected String` | `indexDir`
`static String` | `LOCATION`
`static org.slf4j.Logger` | `log`
`static String` | `SCORE_COMP`
`protected StringDistance` | `sd`
`protected String` | `sourceLocation`
`protected SpellChecker` | `spellChecker`
`static String` | `SPELLCHECKER_ARG_NAME`
`static String` | `STRING_DISTANCE`

Fields inherited from class org.apache.solr.spelling.SolrSpellChecker
`analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD_TYPE, fieldTypeName, name`

Constructor Summary
`AbstractLuceneSpellChecker()`

Method Summary
`protected IndexReader` | `determineReader(IndexReader reader)`
`float` | `getAccuracy()`
`String` | `getField()`
`String` | `getFieldTypeName()`
`String` | `getIndexDir()`
`String` | `getSourceLocation()`
`SpellChecker` | `getSpellChecker()`
`StringDistance` | `getStringDistance()`
`SpellingResult` | `getSuggestions(Collection<Token> tokens, IndexReader reader, int count, boolean onlyMorePopular, boolean extendedResults)` Kept around for back compatibility purposes.
`SpellingResult` | `getSuggestions(SpellingOptions options)` Get suggestions for the given query.
`String` | `init(NamedList config, SolrCore core)`
`protected void` | `initIndex()` Initialize the `index` variable based on the `indexDir`.
`void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the index.

Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
`build, getDictionaryName, getQueryAnalyzer, getSuggestions, getSuggestions, getSuggestions`

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

Field Detail

### log

    public static final org.slf4j.Logger log

### SPELLCHECKER_ARG_NAME

    public static final String SPELLCHECKER_ARG_NAME

See Also:
  Constant Field Values

### LOCATION

    public static final String LOCATION

See Also:
  Constant Field Values

### INDEX_DIR

    public static final String INDEX_DIR

See Also:
  Constant Field Values

### ACCURACY

    public static final String ACCURACY

See Also:
  Constant Field Values

### STRING_DISTANCE

    public static final String STRING_DISTANCE

See Also:
  Constant Field Values

### COMPARATOR_CLASS

    public static final String COMPARATOR_CLASS

See Also:
  Constant Field Values

### SCORE_COMP

    public static final String SCORE_COMP

See Also:
  Constant Field Values

### FREQ_COMP

    public static final String FREQ_COMP

See Also:
  Constant Field Values

### spellChecker

    protected SpellChecker spellChecker

### sourceLocation

    protected String sourceLocation

### index

    protected Directory index

### dictionary

    protected Dictionary dictionary

### DEFAULT_SUGGESTION_COUNT

    public static final int DEFAULT_SUGGESTION_COUNT

See Also:
  Constant Field Values

### indexDir

    protected String indexDir

### accuracy

    protected float accuracy

### FIELD

    public static final String FIELD

See Also:
  Constant Field Values

### sd

    protected StringDistance sd

Constructor Detail

### AbstractLuceneSpellChecker

    public AbstractLuceneSpellChecker()

Method Detail

### init

    public String init(NamedList config,
                       SolrCore core)

  Overrides:
    `init` in class `SolrSpellChecker`

### getSuggestions

    public SpellingResult getSuggestions(Collection<Token> tokens,
                                         IndexReader reader,
                                         int count,
                                         boolean onlyMorePopular,
                                         boolean extendedResults)
                                  throws IOException

  Kept around for back compatibility purposes.

  Specified by:
    `getSuggestions` in class `SolrSpellChecker`
  Parameters:
    `tokens` - The Tokens to be spell checked.
    `reader` - The (optional) IndexReader. If there is not IndexReader, than extendedResults are not possible
    `count` - The maximum number of suggestions to return
    `onlyMorePopular` - TODO
    `extendedResults` - TODO
  Throws:
    `IOException`

### getSuggestions

    public SpellingResult getSuggestions(SpellingOptions options)
                                  throws IOException

  Description copied from class: `SolrSpellChecker`
  Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The `SpellingResult.getSuggestions()` suggestions must be ordered by best suggestion first.

  Note: This method is abstract in Solr 4.0 and beyond and is the recommended way of implementing the spell checker. For now, it calls `SolrSpellChecker.getSuggestions(java.util.Collection, org.apache.lucene.index.IndexReader, boolean, boolean)`.

  Overrides:
    `getSuggestions` in class `SolrSpellChecker`
  Parameters:
    `options` - The `SpellingOptions` to use
  Returns:
    The `SpellingResult` suggestions
  Throws:
    `IOException` - if there is an error producing suggestions

### determineReader

    protected IndexReader determineReader(IndexReader reader)

### reload

    public void reload(SolrCore core,
                       SolrIndexSearcher searcher)
                throws IOException

  Description copied from class: `SolrSpellChecker`
  Reloads the index. Useful if an external process is responsible for building the spell checker.

  Specified by:
    `reload` in class `SolrSpellChecker`
  Throws:
    `IOException`

### initIndex

    protected void initIndex()
                      throws IOException

  Initialize the `index` variable based on the `indexDir`. Does not actually create the spelling index.

  Throws:
    `IOException`

### getAccuracy

    public float getAccuracy()

### getField

    public String getField()

### getFieldTypeName

    public String getFieldTypeName()

### getIndexDir

    public String getIndexDir()

### getSourceLocation

    public String getSourceLocation()

### getStringDistance

    public StringDistance getStringDistance()

### getSpellChecker

    public SpellChecker getSpellChecker()

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