Package org.apache.solr.spelling
Class SpellingResult
- java.lang.Object
- 
- org.apache.solr.spelling.SpellingResult
 
- 
 public class SpellingResult extends Object Implementations of SolrSpellChecker must return suggestions as SpellResult instance. This is converted into the required NamedList format in SpellCheckComponent.- Since:
- solr 1.3
 
- 
- 
Field SummaryFields Modifier and Type Field Description static intNO_FREQUENCY_INFO
 - 
Constructor SummaryConstructors Constructor Description SpellingResult()SpellingResult(Collection<Token> tokens)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(Token token, String suggestion, int docFreq)Suggestions must be added with the best suggestion first.voidadd(Token token, List<String> suggestions)Adds a whole bunch of suggestions, and does not worry about frequency.voidaddFrequency(Token token, int docFreq)Adds an original token with its document frequencyLinkedHashMap<String,Integer>get(Token token)Gets the suggestions for the given token.Map<Token,LinkedHashMap<String,Integer>>getSuggestions()All the suggestions.Map<Token,Integer>getTokenFrequency()IntegergetTokenFrequency(Token token)The token frequency of the input token in the collectionCollection<Token>getTokens()booleanhasTokenFrequencyInfo()voidsetTokens(Collection<Token> tokens)
 
- 
- 
- 
Field Detail- 
NO_FREQUENCY_INFOpublic static final int NO_FREQUENCY_INFO - See Also:
- Constant Field Values
 
 
- 
 - 
Constructor Detail- 
SpellingResultpublic SpellingResult() 
 - 
SpellingResultpublic SpellingResult(Collection<Token> tokens) 
 
- 
 - 
Method Detail- 
addpublic void add(Token token, List<String> suggestions) Adds a whole bunch of suggestions, and does not worry about frequency.- Parameters:
- token- The token to associate the suggestions with
- suggestions- The suggestions
 
 - 
addFrequencypublic void addFrequency(Token token, int docFreq) Adds an original token with its document frequency- Parameters:
- token- original token
- docFreq- original token's document frequency
 
 - 
addpublic void add(Token token, String suggestion, int docFreq) Suggestions must be added with the best suggestion first. ORDER is important.- Parameters:
- token- The- Token
- suggestion- The suggestion for the Token
- docFreq- The document frequency
 
 - 
getpublic LinkedHashMap<String,Integer> get(Token token) Gets the suggestions for the given token.- Parameters:
- token- The- Tokento look up
- Returns:
- A LinkedHashMap of the suggestions. Key is the suggestion, value is the token frequency
     in the index, else NO_FREQUENCY_INFO.The suggestions are added in sorted order (i.e. best suggestion first) then the iterator will return the suggestions in order 
 
 - 
getTokenFrequencypublic Integer getTokenFrequency(Token token) The token frequency of the input token in the collection- Parameters:
- token- The token
- Returns:
- The frequency or null
 
 - 
hasTokenFrequencyInfopublic boolean hasTokenFrequencyInfo() 
 - 
getSuggestionspublic Map<Token,LinkedHashMap<String,Integer>> getSuggestions() All the suggestions. The ordering of the inner LinkedHashMap is by best suggestion first.- Returns:
- The Map of suggestions for each Token. Key is the token, value is a LinkedHashMap whose
     key is the Suggestion and the value is the frequency or NO_FREQUENCY_INFOif frequency info is not available.
 
 - 
getTokenspublic Collection<Token> getTokens() - Returns:
- The original tokens
 
 - 
setTokenspublic void setTokens(Collection<Token> tokens) 
 
- 
 
-