Package org.apache.solr.spelling
Class DirectSolrSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.DirectSolrSpellChecker
Spellchecker implementation that uses
DirectSpellChecker
Requires 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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Stringstatic final Stringstatic final floatstatic final intstatic final intstatic final floatstatic final intstatic final intstatic final intstatic final floatstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final StringFields inherited from class org.apache.solr.spelling.SolrSpellChecker
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild(SolrCore core, SolrIndexSearcher searcher) (re)Builds the spelling index.floatGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported.org.apache.lucene.search.spell.StringDistanceGet the distance implementation used by this spellchecker, or NULL if not applicable.getSuggestions(SpellingOptions options) Get suggestions for the given query.mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults) Integrate spelling suggestions from the various shards in a distributed environment.voidmodifyRequest(ResponseBuilder rb, ShardRequest sreq) modify the shard request to be used in a distributed environment.voidreload(SolrCore core, SolrIndexSearcher searcher) Reloads the index.Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
getDictionaryName, getQueryAnalyzer, isSuggestionsMayOverlap
-
Field Details
-
COMPARATOR_CLASS
- See Also:
-
SCORE_COMP
- See Also:
-
FREQ_COMP
- See Also:
-
STRING_DISTANCE
- See Also:
-
ACCURACY
- See Also:
-
THRESHOLD_TOKEN_FREQUENCY
- See Also:
-
INTERNAL_DISTANCE
- See Also:
-
DEFAULT_ACCURACY
public static final float DEFAULT_ACCURACY- See Also:
-
DEFAULT_THRESHOLD_TOKEN_FREQUENCY
public static final float DEFAULT_THRESHOLD_TOKEN_FREQUENCY- See Also:
-
MAXEDITS
- See Also:
-
DEFAULT_MAXEDITS
public static final int DEFAULT_MAXEDITS- See Also:
-
MINPREFIX
- See Also:
-
DEFAULT_MINPREFIX
public static final int DEFAULT_MINPREFIX- See Also:
-
MAXINSPECTIONS
- See Also:
-
DEFAULT_MAXINSPECTIONS
public static final int DEFAULT_MAXINSPECTIONS- See Also:
-
MINQUERYLENGTH
- See Also:
-
DEFAULT_MINQUERYLENGTH
public static final int DEFAULT_MINQUERYLENGTH- See Also:
-
MAXQUERYLENGTH
- See Also:
-
DEFAULT_MAXQUERYLENGTH
public static final int DEFAULT_MAXQUERYLENGTH- See Also:
-
MAXQUERYFREQUENCY
- See Also:
-
DEFAULT_MAXQUERYFREQUENCY
public static final float DEFAULT_MAXQUERYFREQUENCY- See Also:
-
-
Constructor Details
-
DirectSolrSpellChecker
public DirectSolrSpellChecker()
-
-
Method Details
-
init
- Overrides:
initin classSolrSpellChecker
-
reload
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
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
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
-
modifyRequest
Description copied from class:SolrSpellCheckermodify the shard request to be used in a distributed environment.- Overrides:
modifyRequestin classSolrSpellChecker
-
mergeSuggestions
public SpellingResult mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults) Description copied from class:SolrSpellCheckerIntegrate spelling suggestions from the various shards in a distributed environment.- Overrides:
mergeSuggestionsin classSolrSpellChecker
-
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
-