Package org.apache.solr.spelling
Class ConjunctionSolrSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.ConjunctionSolrSpellChecker
This class lets a query be run through multiple spell checkers. The initial use-case is to use
WordBreakSolrSpellChecker in conjunction with a "standard" spell checker (such as DirectSolrSpellChecker-
Field Summary
Fields 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 TypeMethodDescriptionvoidaddChecker(SolrSpellChecker checker) 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.getSuggestions(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.voidreload(SolrCore core, SolrIndexSearcher searcher) Reloads the index.
-
Constructor Details
-
ConjunctionSolrSpellChecker
public ConjunctionSolrSpellChecker()
-
-
Method Details
-
addChecker
-
init
- Overrides:
initin classSolrSpellChecker
-
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
-
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.
-
getQueryAnalyzer
public org.apache.lucene.analysis.Analyzer getQueryAnalyzer()- Overrides:
getQueryAnalyzerin classSolrSpellChecker
-
getDictionaryName
- Overrides:
getDictionaryNamein classSolrSpellChecker
-
getAccuracy
protected float getAccuracy()Description copied from class:SolrSpellCheckerGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported. Otherwise throws UnsupportedOperationException.- Overrides:
getAccuracyin classSolrSpellChecker
-
getStringDistance
protected 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
-
isSuggestionsMayOverlap
public boolean isSuggestionsMayOverlap()- Overrides:
isSuggestionsMayOverlapin classSolrSpellChecker
-