org.apache.solr.spelling
Class DirectSolrSpellChecker

java.lang.Object
  extended by org.apache.solr.spelling.SolrSpellChecker
      extended by org.apache.solr.spelling.DirectSolrSpellChecker

public class DirectSolrSpellChecker
extends SolrSpellChecker

Spellchecker implementation that uses DirectSpellChecker

Requires no auxiliary index or data structure.

Supported options:

See Also:
DirectSpellChecker

Field Summary
static String ACCURACY
           
static String COMPARATOR_CLASS
           
static float DEFAULT_ACCURACY
           
static int DEFAULT_MAXEDITS
           
static int DEFAULT_MAXINSPECTIONS
           
static float DEFAULT_MAXQUERYFREQUENCY
           
static int DEFAULT_MINPREFIX
           
static int DEFAULT_MINQUERYLENGTH
           
static float DEFAULT_THRESHOLD_TOKEN_FREQUENCY
           
static String FREQ_COMP
           
static String INTERNAL_DISTANCE
           
static String MAXEDITS
           
static String MAXINSPECTIONS
           
static String MAXQUERYFREQUENCY
           
static String MINPREFIX
           
static String MINQUERYLENGTH
           
static String SCORE_COMP
           
static String STRING_DISTANCE
           
static String THRESHOLD_TOKEN_FREQUENCY
           
 
Fields inherited from class org.apache.solr.spelling.SolrSpellChecker
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name
 
Constructor Summary
DirectSolrSpellChecker()
           
 
Method Summary
 void build(SolrCore core, SolrIndexSearcher searcher)
          (re)Builds the spelling index.
 float getAccuracy()
          Get the value of SpellingParams.SPELLCHECK_ACCURACY if supported.
 StringDistance getStringDistance()
          Get the distance implementation used by this spellchecker, or NULL if not applicable.
 SpellingResult getSuggestions(SpellingOptions options)
          Get suggestions for the given query.
 String init(NamedList config, SolrCore core)
           
 void reload(SolrCore core, SolrIndexSearcher searcher)
          Reloads the index.
 
Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
getDictionaryName, getQueryAnalyzer, isSuggestionsMayOverlap, mergeSuggestions
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

STRING_DISTANCE

public static final String STRING_DISTANCE
See Also:
Constant Field Values

ACCURACY

public static final String ACCURACY
See Also:
Constant Field Values

THRESHOLD_TOKEN_FREQUENCY

public static final String THRESHOLD_TOKEN_FREQUENCY
See Also:
Constant Field Values

INTERNAL_DISTANCE

public static final String INTERNAL_DISTANCE
See Also:
Constant Field Values

DEFAULT_ACCURACY

public static final float DEFAULT_ACCURACY
See Also:
Constant Field Values

DEFAULT_THRESHOLD_TOKEN_FREQUENCY

public static final float DEFAULT_THRESHOLD_TOKEN_FREQUENCY
See Also:
Constant Field Values

MAXEDITS

public static final String MAXEDITS
See Also:
Constant Field Values

DEFAULT_MAXEDITS

public static final int DEFAULT_MAXEDITS
See Also:
Constant Field Values

MINPREFIX

public static final String MINPREFIX
See Also:
Constant Field Values

DEFAULT_MINPREFIX

public static final int DEFAULT_MINPREFIX
See Also:
Constant Field Values

MAXINSPECTIONS

public static final String MAXINSPECTIONS
See Also:
Constant Field Values

DEFAULT_MAXINSPECTIONS

public static final int DEFAULT_MAXINSPECTIONS
See Also:
Constant Field Values

MINQUERYLENGTH

public static final String MINQUERYLENGTH
See Also:
Constant Field Values

DEFAULT_MINQUERYLENGTH

public static final int DEFAULT_MINQUERYLENGTH
See Also:
Constant Field Values

MAXQUERYFREQUENCY

public static final String MAXQUERYFREQUENCY
See Also:
Constant Field Values

DEFAULT_MAXQUERYFREQUENCY

public static final float DEFAULT_MAXQUERYFREQUENCY
See Also:
Constant Field Values
Constructor Detail

DirectSolrSpellChecker

public DirectSolrSpellChecker()
Method Detail

init

public String init(NamedList config,
                   SolrCore core)
Overrides:
init in class SolrSpellChecker

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 - If there is a low-level I/O error.

build

public void build(SolrCore core,
                  SolrIndexSearcher searcher)
           throws IOException
Description copied from class: SolrSpellChecker
(re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.

Specified by:
build in class SolrSpellChecker
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.

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

getAccuracy

public float getAccuracy()
Description copied from class: SolrSpellChecker
Get the value of SpellingParams.SPELLCHECK_ACCURACY if supported. Otherwise throws UnsupportedOperationException.

Overrides:
getAccuracy in class SolrSpellChecker

getStringDistance

public StringDistance getStringDistance()
Description copied from class: SolrSpellChecker
Get the distance implementation used by this spellchecker, or NULL if not applicable.

Overrides:
getStringDistance in class SolrSpellChecker


Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.