Package org.apache.solr.spelling
Class AbstractLuceneSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.AbstractLuceneSpellChecker
- Direct Known Subclasses:
FileBasedSpellChecker,IndexBasedSpellChecker
Abstract base class for all Lucene-based spell checking implementations.
Refer to https://solr.apache.org/guide/solr/latest/query-guide/spell-checking.html for more details.
- Since:
- solr 1.3
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected floatstatic final Stringstatic final Stringstatic final intprotected org.apache.lucene.search.spell.Dictionarystatic final Stringstatic final Stringprotected org.apache.lucene.store.Directorystatic final Stringprotected Pathstatic final Stringstatic final Stringprotected org.apache.lucene.search.spell.StringDistanceprotected Stringprotected org.apache.lucene.search.spell.SpellCheckerstatic final Stringstatic final StringFields inherited from class org.apache.solr.spelling.SolrSpellChecker
analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD_TYPE, fieldTypeName, name -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected org.apache.lucene.index.IndexReaderdetermineReader(org.apache.lucene.index.IndexReader reader) floatGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported.getField()org.apache.lucene.search.spell.SpellCheckerorg.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.protected voidvoidreload(SolrCore core, SolrIndexSearcher searcher) Reloads the index.Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
build, getDictionaryName, getQueryAnalyzer, isSuggestionsMayOverlap, mergeSuggestions, modifyRequest
-
Field Details
-
SPELLCHECKER_ARG_NAME
- See Also:
-
LOCATION
- See Also:
-
INDEX_DIR
- See Also:
-
ACCURACY
- See Also:
-
STRING_DISTANCE
- See Also:
-
COMPARATOR_CLASS
- See Also:
-
SCORE_COMP
- See Also:
-
FREQ_COMP
- See Also:
-
spellChecker
protected org.apache.lucene.search.spell.SpellChecker spellChecker -
sourceLocation
-
index
protected org.apache.lucene.store.Directory index -
dictionary
protected org.apache.lucene.search.spell.Dictionary dictionary -
DEFAULT_SUGGESTION_COUNT
public static final int DEFAULT_SUGGESTION_COUNT- See Also:
-
indexDir
-
accuracy
protected float accuracy -
FIELD
- See Also:
-
sd
protected org.apache.lucene.search.spell.StringDistance sd
-
-
Constructor Details
-
AbstractLuceneSpellChecker
public AbstractLuceneSpellChecker()
-
-
Method Details
-
init
- Overrides:
initin classSolrSpellChecker
-
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
-
determineReader
protected org.apache.lucene.index.IndexReader determineReader(org.apache.lucene.index.IndexReader reader) -
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.
-
initIndex
- Throws:
IOException- If there is a low-level I/O error.
-
getAccuracy
public float getAccuracy()Description copied from class:SolrSpellCheckerGet the value ofSpellingParams.SPELLCHECK_ACCURACYif supported. Otherwise throws UnsupportedOperationException.- Overrides:
getAccuracyin classSolrSpellChecker
-
getField
-
getFieldTypeName
-
getIndexDir
-
getSourceLocation
-
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
-
getSpellChecker
public org.apache.lucene.search.spell.SpellChecker getSpellChecker()
-