Package org.apache.solr.spelling
Class SolrSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
- Direct Known Subclasses:
AbstractLuceneSpellChecker,ConjunctionSolrSpellChecker,DirectSolrSpellChecker,Suggester,WordBreakSolrSpellChecker
Refer to https://solr.apache.org/guide/solr/latest/query-guide/spell-checking.html
for more details.
- Since:
- solr 1.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract voidbuild(SolrCore core, SolrIndexSearcher searcher) (re)Builds the spelling index.protected floatGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported.org.apache.lucene.analysis.Analyzerprotected org.apache.lucene.search.spell.StringDistanceGet the distance implementation used by this spellchecker, or NULL if not applicable.abstract SpellingResultgetSuggestions(SpellingOptions options) Get suggestions for the given query.booleanmergeSuggestions(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.abstract voidreload(SolrCore core, SolrIndexSearcher searcher) Reloads the index.
-
Field Details
-
DICTIONARY_NAME
- See Also:
-
DEFAULT_DICTIONARY_NAME
- See Also:
-
FIELD
- See Also:
-
FIELD_TYPE
- See Also:
-
name
Dictionary name -
analyzer
protected org.apache.lucene.analysis.Analyzer analyzer -
field
-
fieldTypeName
-
-
Constructor Details
-
SolrSpellChecker
public SolrSpellChecker()
-
-
Method Details
-
init
-
modifyRequest
modify the shard request to be used in a distributed environment. -
mergeSuggestions
public SpellingResult mergeSuggestions(SpellCheckMergeData mergeData, int numSug, int count, boolean extendedResults) Integrate spelling suggestions from the various shards in a distributed environment. -
getQueryAnalyzer
public org.apache.lucene.analysis.Analyzer getQueryAnalyzer() -
getDictionaryName
-
reload
Reloads the index. Useful if an external process is responsible for building the spell checker.- Throws:
IOException- If there is a low-level I/O error.
-
build
(re)Builds the spelling index. May be a NOOP if the implementation doesn't require building, or can't be rebuilt.- Throws:
IOException
-
getAccuracy
protected float getAccuracy()Get the value ofSpellingParams.SPELLCHECK_ACCURACYif supported. Otherwise throws UnsupportedOperationException. -
getStringDistance
protected org.apache.lucene.search.spell.StringDistance getStringDistance()Get the distance implementation used by this spellchecker, or NULL if not applicable. -
getSuggestions
Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. TheSpellingResult.getSuggestions()suggestions must be ordered by best suggestion first.- Parameters:
options- TheSpellingOptionsto use- Returns:
- The
SpellingResultsuggestions - Throws:
IOException- if there is an error producing suggestions
-
isSuggestionsMayOverlap
public boolean isSuggestionsMayOverlap()
-