Package org.apache.solr.spelling
Class DirectSolrSpellChecker
- java.lang.Object
-
- org.apache.solr.spelling.SolrSpellChecker
-
- org.apache.solr.spelling.DirectSolrSpellChecker
-
public class DirectSolrSpellChecker extends SolrSpellChecker
Spellchecker implementation that usesDirectSpellCheckerRequires no auxiliary index or data structure.
Supported options:
- field: Used as the source of terms.
- distanceMeasure: Sets
DirectSpellChecker.setDistance(StringDistance). Note: to set the defaultDirectSpellChecker.INTERNAL_LEVENSHTEIN, use "internal". - accuracy: Sets
DirectSpellChecker.setAccuracy(float). - maxEdits: Sets
DirectSpellChecker.setMaxEdits(int). - minPrefix: Sets
DirectSpellChecker.setMinPrefix(int). - maxInspections: Sets
DirectSpellChecker.setMaxInspections(int). - comparatorClass: Sets
DirectSpellChecker.setComparator(Comparator). Note: score-then-frequency can be specified as "score" and frequency-then-score can be specified as "freq". - thresholdTokenFrequency: sets
DirectSpellChecker.setThresholdFrequency(float). - minQueryLength: sets
DirectSpellChecker.setMinQueryLength(int). - maxQueryLength: sets
DirectSpellChecker.setMaxQueryLength(int). - maxQueryFrequency: sets
DirectSpellChecker.setMaxQueryFrequency(float).
- See Also:
DirectSpellChecker
-
-
Field Summary
Fields Modifier and Type Field Description static StringACCURACYstatic StringCOMPARATOR_CLASSstatic floatDEFAULT_ACCURACYstatic intDEFAULT_MAXEDITSstatic intDEFAULT_MAXINSPECTIONSstatic floatDEFAULT_MAXQUERYFREQUENCYstatic intDEFAULT_MAXQUERYLENGTHstatic intDEFAULT_MINPREFIXstatic intDEFAULT_MINQUERYLENGTHstatic floatDEFAULT_THRESHOLD_TOKEN_FREQUENCYstatic StringFREQ_COMPstatic StringINTERNAL_DISTANCEstatic StringMAXEDITSstatic StringMAXINSPECTIONSstatic StringMAXQUERYFREQUENCYstatic StringMAXQUERYLENGTHstatic StringMINPREFIXstatic StringMINQUERYLENGTHstatic StringSCORE_COMPstatic StringSTRING_DISTANCEstatic StringTHRESHOLD_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
Constructors Constructor Description DirectSolrSpellChecker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbuild(SolrCore core, SolrIndexSearcher searcher)(re)Builds the spelling index.floatgetAccuracy()Get the value ofSpellingParams.SPELLCHECK_ACCURACYif supported.org.apache.lucene.search.spell.StringDistancegetStringDistance()Get the distance implementation used by this spellchecker, or NULL if not applicable.SpellingResultgetSuggestions(SpellingOptions options)Get suggestions for the given query.Stringinit(NamedList config, SolrCore core)voidreload(SolrCore core, SolrIndexSearcher searcher)Reloads the index.-
Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
getDictionaryName, getQueryAnalyzer, isSuggestionsMayOverlap, mergeSuggestions
-
-
-
-
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
-
MAXQUERYLENGTH
public static final String MAXQUERYLENGTH
- See Also:
- Constant Field Values
-
DEFAULT_MAXQUERYLENGTH
public static final int DEFAULT_MAXQUERYLENGTH
- 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
-
-
Method Detail
-
init
public String init(NamedList config, SolrCore core)
- Overrides:
initin classSolrSpellChecker
-
reload
public void reload(SolrCore core, SolrIndexSearcher searcher) throws IOException
Description copied from class:SolrSpellCheckerReloads the index. Useful if an external process is responsible for building the spell checker.- Specified by:
reloadin classSolrSpellChecker- 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:
buildin classSolrSpellChecker- Throws:
IOException
-
getSuggestions
public SpellingResult getSuggestions(SpellingOptions options) throws IOException
Description copied from class:SolrSpellCheckerGet suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. TheSpellingResult.getSuggestions()suggestions must be ordered by best suggestion first.- Specified by:
getSuggestionsin classSolrSpellChecker- Parameters:
options- TheSpellingOptionsto use- Returns:
- The
SpellingResultsuggestions - Throws:
IOException- if there is an error producing suggestions
-
getAccuracy
public float getAccuracy()
Description copied from class:SolrSpellCheckerGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported. Otherwise throws UnsupportedOperationException.- Overrides:
getAccuracyin classSolrSpellChecker
-
getStringDistance
public org.apache.lucene.search.spell.StringDistance getStringDistance()
Description copied from class:SolrSpellCheckerGet the distance implementation used by this spellchecker, or NULL if not applicable.- Overrides:
getStringDistancein classSolrSpellChecker
-
-