SpellingResult (Solr 3.6.2 API)
Keywords: org.apache.solr.spelling.SpellingResult class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 Summary
`static int` | `NO_FREQUENCY_INFO`

Constructor Summary
`SpellingResult()`
`SpellingResult(Collection<Token> tokens)`

Method Summary
`void` | `add(Token token, int docFreq)` Deprecated. use `addFrequency(Token, int)` instead.
`void` | `add(Token token, List<String> suggestions)` Adds a whole bunch of suggestions, and does not worry about frequency.
`void` | `add(Token token, String suggestion, int docFreq)` Suggestions must be added with the best suggestion first.
`void` | `addFrequency(Token token, int docFreq)` Adds an original token with its document frequency
`LinkedHashMap<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()`
`Integer` | `getTokenFrequency(Token token)` The token frequency of the input token in the collection
`Collection<Token>` | `getTokens()`
`boolean` | `hasTokenFrequencyInfo()`
`void` | `setTokens(Collection<Token> tokens)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NO_FREQUENCY_INFO

    public static final int NO_FREQUENCY_INFO

See Also:
  Constant Field Values

Constructor Detail

### SpellingResult

    public SpellingResult()

### SpellingResult

    public SpellingResult(Collection<Token> tokens)

Method Detail

### add

    public 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

### add

    @Deprecated
    public void add(Token token,
                               int docFreq)

  Deprecated. use `addFrequency(Token, int)` instead.

### addFrequency

    public void addFrequency(Token token,
                             int docFreq)

  Adds an original token with its document frequency

  Parameters:
    `token` - original token
    `docFreq` - original token's document frequency

### add

    public 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

### get

    public LinkedHashMap<String,Integer> get(Token token)

  Gets the suggestions for the given token.

  Parameters:
    `token` - The `Token` to 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

    public Integer getTokenFrequency(Token token)

  The token frequency of the input token in the collection

  Parameters:
    `token` - The token
  Returns:
    The frequency or null

### hasTokenFrequencyInfo

    public boolean hasTokenFrequencyInfo()

### getSuggestions

    public 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_INFO` if frequency info is not available.

### getTokenFrequency

    public Map<Token,Integer> getTokenFrequency()

### getTokens

    public Collection<Token> getTokens()

  Returns:
    The original tokens

### setTokens

    public void setTokens(Collection<Token> tokens)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD