Suggester (Solr 3.6.2 API)
Keywords: org.apache.solr.spelling.suggest.Suggester 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.suggest
Class Suggester

    java.lang.Object
      org.apache.solr.spelling.SolrSpellChecker
          org.apache.solr.spelling.suggest.Suggester

    public class Suggester

extends SolrSpellChecker

Field Summary
`protected SolrCore` | `core`
`protected Dictionary` | `dictionary`
`static String` | `LOCATION` Location of the source data - either a path to a file, or null for the current IndexReader.
`protected Lookup` | `lookup`
`static String` | `LOOKUP_IMPL` Fully-qualified class of the `Lookup` implementation.
`protected String` | `lookupImpl`
`protected IndexReader` | `reader`
`protected String` | `sourceLocation`
`static String` | `STORE_DIR` Name of the location where to persist the dictionary.
`protected File` | `storeDir`
`protected float` | `threshold`
`static String` | `THRESHOLD_TOKEN_FREQUENCY` Minimum frequency of terms to consider when building the dictionary.

Fields inherited from class org.apache.solr.spelling.SolrSpellChecker
`analyzer, DEFAULT_DICTIONARY_NAME, DICTIONARY_NAME, field, FIELD, FIELD_TYPE, fieldTypeName, name`

Constructor Summary
`Suggester()`

Method Summary
`void` | `build(SolrCore core, SolrIndexSearcher searcher)` (re)Builds the spelling index.
`SpellingResult` | `getSuggestions(Collection<Token> tokens, IndexReader reader, int count, boolean onlyMorePopular, boolean extendedResults)` Get suggestions for the given query.
`SpellingResult` | `getSuggestions(SpellingOptions options)` Get suggestions for the given query.
`String` | `init(NamedList config, SolrCore core)`
`void` | `reload(SolrCore core, SolrIndexSearcher searcher)` Reloads the index.

Methods inherited from class org.apache.solr.spelling.SolrSpellChecker
`getDictionaryName, getQueryAnalyzer, getSuggestions, getSuggestions, getSuggestions`

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

Field Detail

### LOCATION

    public static final String LOCATION

  Location of the source data - either a path to a file, or null for the current IndexReader.

  See Also:
    Constant Field Values

### LOOKUP_IMPL

    public static final String LOOKUP_IMPL

  Fully-qualified class of the `Lookup` implementation.

  See Also:
    Constant Field Values

### THRESHOLD_TOKEN_FREQUENCY

    public static final String THRESHOLD_TOKEN_FREQUENCY

  Minimum frequency of terms to consider when building the dictionary.

  See Also:
    Constant Field Values

### STORE_DIR

    public static final String STORE_DIR

  Name of the location where to persist the dictionary. If this location is relative then the data will be stored under the core's dataDir. If this is null the storing will be disabled.

  See Also:
    Constant Field Values

### sourceLocation

    protected String sourceLocation

### storeDir

    protected File storeDir

### threshold

    protected float threshold

### dictionary

    protected Dictionary dictionary

### reader

    protected IndexReader reader

### lookup

    protected Lookup lookup

### lookupImpl

    protected String lookupImpl

### core

    protected SolrCore core

Constructor Detail

### Suggester

    public Suggester()

Method Detail

### init

    public String init(NamedList config,
                       SolrCore core)

  Overrides:
    `init` in class `SolrSpellChecker`

### build

    public void build(SolrCore core,
                      SolrIndexSearcher searcher)

  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:
    `build` in class `SolrSpellChecker`

### reload

    public void reload(SolrCore core,
                       SolrIndexSearcher searcher)
                throws IOException

  Description copied from class: `SolrSpellChecker`
  Reloads the index. Useful if an external process is responsible for building the spell checker.

  Specified by:
    `reload` in class `SolrSpellChecker`
  Throws:
    `IOException`

### getSuggestions

    public SpellingResult getSuggestions(Collection<Token> tokens,
                                         IndexReader reader,
                                         int count,
                                         boolean onlyMorePopular,
                                         boolean extendedResults)
                                  throws IOException

  Description copied from class: `SolrSpellChecker`
  Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The `SpellingResult.getSuggestions()` suggestions must be ordered by best suggestion first.

  Specified by:
    `getSuggestions` in class `SolrSpellChecker`
  Parameters:
    `tokens` - The Tokens to be spell checked.
    `reader` - The (optional) IndexReader. If there is not IndexReader, than extendedResults are not possible
    `count` - The maximum number of suggestions to return
    `onlyMorePopular` - TODO
    `extendedResults` - TODO
  Throws:
    `IOException`

### getSuggestions

    public SpellingResult getSuggestions(SpellingOptions options)
                                  throws IOException

  Description copied from class: `SolrSpellChecker`
  Get suggestions for the given query. Tokenizes the query using a field appropriate Analyzer. The `SpellingResult.getSuggestions()` suggestions must be ordered by best suggestion first.

  Note: This method is abstract in Solr 4.0 and beyond and is the recommended way of implementing the spell checker. For now, it calls `SolrSpellChecker.getSuggestions(java.util.Collection, org.apache.lucene.index.IndexReader, boolean, boolean)`.

  Overrides:
    `getSuggestions` in class `SolrSpellChecker`
  Parameters:
    `options` - The `SpellingOptions` to use
  Returns:
    The `SpellingResult` suggestions
  Throws:
    `IOException` - if there is an error producing suggestions

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