Package org.apache.solr.spelling
Class WordBreakSolrSpellChecker
java.lang.Object
org.apache.solr.spelling.SolrSpellChecker
org.apache.solr.spelling.WordBreakSolrSpellChecker
A spellchecker that breaks and combines words.
This will not combine adjacent tokens that do not have the same required status (prohibited,
required, optional). However, this feature depends on incoming term flags being properly set.
(QueryConverter.PROHIBITED_TERM_FLAG, QueryConverter.REQUIRED_TERM_FLAG, QueryConverter.TERM_IN_BOOLEAN_QUERY_FLAG, and QueryConverter.TERM_PRECEDES_NEW_BOOLEAN_OPERATOR_FLAG ) This feature breaks completely if the
upstream analyzer or query converter sets flags with the same values but different meanings. The
default query converter (if not using "spellcheck.q") is SpellingQueryConverter, which
properly sets these flags.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumSpecify a value on the "breakSuggestionTieBreaker" parameter. -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringSeeWordBreakSolrSpellChecker.BreakSuggestionTieBreakerfor options.static final StringTry to break words into multiples? [true|false]static final StringTry to combine multiple words into one? [true|false]static final StringSeeWordBreakSpellChecker.setMaxChanges(int)static final StringSeeWordBreakSpellChecker.setMaxCombineWordLength(int)static final StringSeeWordBreakSpellChecker.setMaxEvaluations(int)static final StringSeeWordBreakSpellChecker.setMinBreakWordLength(int)static final StringSeeWordBreakSpellChecker.setMinSuggestionFrequency(int)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 TypeMethodDescriptionvoidbuild(SolrCore core, SolrIndexSearcher searcher) (re)Builds the spelling index.getSuggestions(SpellingOptions options) Get suggestions for the given query.booleanvoidreload(SolrCore core, SolrIndexSearcher searcher) Reloads the index.Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
getAccuracy, getDictionaryName, getQueryAnalyzer, getStringDistance, mergeSuggestions, modifyRequest
-
Field Details
-
PARAM_COMBINE_WORDS
Try to combine multiple words into one? [true|false]- See Also:
-
PARAM_BREAK_WORDS
Try to break words into multiples? [true|false]- See Also:
-
PARAM_MAX_CHANGES
SeeWordBreakSpellChecker.setMaxChanges(int)- See Also:
-
PARAM_MAX_COMBINE_WORD_LENGTH
SeeWordBreakSpellChecker.setMaxCombineWordLength(int)- See Also:
-
PARAM_MIN_BREAK_WORD_LENGTH
SeeWordBreakSpellChecker.setMinBreakWordLength(int)- See Also:
-
PARAM_BREAK_SUGGESTION_TIE_BREAKER
SeeWordBreakSolrSpellChecker.BreakSuggestionTieBreakerfor options.- See Also:
-
PARAM_MAX_EVALUATIONS
SeeWordBreakSpellChecker.setMaxEvaluations(int)- See Also:
-
PARAM_MIN_SUGGESTION_FREQUENCY
SeeWordBreakSpellChecker.setMinSuggestionFrequency(int)- See Also:
-
-
Constructor Details
-
WordBreakSolrSpellChecker
public WordBreakSolrSpellChecker()
-
-
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
-
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
-
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.
-
isSuggestionsMayOverlap
public boolean isSuggestionsMayOverlap()- Overrides:
isSuggestionsMayOverlapin classSolrSpellChecker
-