Package org.apache.solr.spelling
Class SpellingResult
java.lang.Object
org.apache.solr.spelling.SpellingResult
Implementations of SolrSpellChecker must return suggestions as SpellResult instance. This is
converted into the required NamedList format in SpellCheckComponent.
- Since:
- solr 1.3
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidSuggestions must be added with the best suggestion first.voidAdds a whole bunch of suggestions, and does not worry about frequency.voidaddFrequency(Token token, int docFreq) Adds an original token with its document frequencyGets the suggestions for the given token.All the suggestions.getTokenFrequency(Token token) The token frequency of the input token in the collectionbooleanvoidsetTokens(Collection<Token> tokens)
-
Field Details
-
NO_FREQUENCY_INFO
public static final int NO_FREQUENCY_INFO- See Also:
-
-
Constructor Details
-
SpellingResult
public SpellingResult() -
SpellingResult
-
-
Method Details
-
add
Adds a whole bunch of suggestions, and does not worry about frequency.- Parameters:
token- The token to associate the suggestions withsuggestions- The suggestions
-
addFrequency
Adds an original token with its document frequency- Parameters:
token- original tokendocFreq- original token's document frequency
-
add
Suggestions must be added with the best suggestion first. ORDER is important.- Parameters:
token- TheTokensuggestion- The suggestion for the TokendocFreq- The document frequency
-
get
Gets the suggestions for the given token.- Parameters:
token- TheTokento 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
-
getTokenFrequency
The token frequency of the input token in the collection- Parameters:
token- The token- Returns:
- The frequency or null
-
hasTokenFrequencyInfo
public boolean hasTokenFrequencyInfo() -
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.
-
getTokenFrequency
-
getTokens
- Returns:
- The original tokens
-
setTokens
-