SpellCheckComponent (Solr 3.6.2 API)
Keywords: org.apache.solr.handler.component.SpellCheckComponent 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.handler.component
Class SpellCheckComponent

    java.lang.Object
      org.apache.solr.handler.component.SearchComponent
          org.apache.solr.handler.component.SpellCheckComponent

All Implemented Interfaces:
  SpellingParams, SolrInfoMBean, NamedListInitializedPlugin, SolrCoreAware

    public class SpellCheckComponent

extends SearchComponent
implements SolrCoreAware, SpellingParams

A SearchComponent implementation which provides support for spell checking and suggestions using the Lucene contributed SpellChecker.

Refer to http://wiki.apache.org/solr/SpellCheckComponent for more details

Since:
  solr 1.3

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean
`SolrInfoMBean.Category`

Field Summary
`static String` | `COMPONENT_NAME` Base name for all spell checker query parameters.
`static boolean` | `DEFAULT_ONLY_MORE_POPULAR`
`protected NamedList` | `initParams`
`protected QueryConverter` | `queryConverter`
`protected Map<String,SolrSpellChecker>` | `spellCheckers` Key is the dictionary, value is the SpellChecker for that dictionary name

Fields inherited from interface org.apache.solr.common.params.SpellingParams
`SPELLCHECK_ACCURACY, SPELLCHECK_BUILD, SPELLCHECK_COLLATE, SPELLCHECK_COLLATE_EXTENDED_RESULTS, SPELLCHECK_COUNT, SPELLCHECK_DICT, SPELLCHECK_EXTENDED_RESULTS, SPELLCHECK_MAX_COLLATION_EVALUATIONS, SPELLCHECK_MAX_COLLATION_TRIES, SPELLCHECK_MAX_COLLATIONS, SPELLCHECK_ONLY_MORE_POPULAR, SPELLCHECK_PREFIX, SPELLCHECK_Q, SPELLCHECK_RELOAD`

Constructor Summary
`SpellCheckComponent()`

Method Summary
`protected void` | `addCollationsToResponse(SolrParams params, SpellingResult spellingResult, ResponseBuilder rb, String q, NamedList response)`
`void` | `finishStage(ResponseBuilder rb)` Called after all responses have been received for this stage.
`protected SolrParams` | `getCustomParams(String dictionary, SolrParams params, boolean shardRequest)` For every param that is of the form "spellcheck.[dictionary name].XXXX=YYYY, add XXXX=YYYY as a param to the custom param list
`String` | `getDescription()` Simple one or two line description
`String` | `getSource()` CVS Source, SVN Source, etc
`String` | `getSourceId()` CVS Id, SVN Id, etc
`protected SolrSpellChecker` | `getSpellChecker(SolrParams params)`
`SolrSpellChecker` | `getSpellChecker(String name)`
`Map<String,SolrSpellChecker>` | `getSpellCheckers()`
`String` | `getVersion()` Simple common usage version, e.g.
`void` | `inform(SolrCore core)`
`void` | `init(NamedList args)`
`void` | `modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq)` Called after another component adds a request
`void` | `prepare(ResponseBuilder rb)` Prepare the response.
`void` | `process(ResponseBuilder rb)` Process the request for this component
`protected NamedList` | `toNamedList(boolean shardRequest, SpellingResult spellingResult, String origQuery, boolean extendedResults, boolean collate)`

Methods inherited from class org.apache.solr.handler.component.SearchComponent
`distributedProcess, getCategory, getDocs, getName, getStatistics, handleResponses`

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

Field Detail

### DEFAULT_ONLY_MORE_POPULAR

    public static final boolean DEFAULT_ONLY_MORE_POPULAR

See Also:
  Constant Field Values

### COMPONENT_NAME

    public static final String COMPONENT_NAME

  Base name for all spell checker query parameters. This name is also used to register this component with SearchHandler.

  See Also:
    Constant Field Values

### initParams

    protected NamedList initParams

### spellCheckers

    protected Map<String,SolrSpellChecker> spellCheckers

  Key is the dictionary, value is the SpellChecker for that dictionary name

### queryConverter

    protected QueryConverter queryConverter

Constructor Detail

### SpellCheckComponent

    public SpellCheckComponent()

Method Detail

### init

    public void init(NamedList args)

  Specified by:
    `init` in interface `NamedListInitializedPlugin`
  Overrides:
    `init` in class `SearchComponent`

### prepare

    public void prepare(ResponseBuilder rb)
                 throws IOException

  Description copied from class: `SearchComponent`
  Prepare the response. Guaranteed to be called before any SearchComponent `SearchComponent.process(org.apache.solr.handler.component.ResponseBuilder)` method. Called for every incoming request. The place to do initialization that is request dependent.

  Specified by:
    `prepare` in class `SearchComponent`
  Parameters:
    `rb` - The `ResponseBuilder`
  Throws:
    `IOException`

### process

    public void process(ResponseBuilder rb)
                 throws IOException

  Description copied from class: `SearchComponent`
  Process the request for this component

  Specified by:
    `process` in class `SearchComponent`
  Parameters:
    `rb` - The `ResponseBuilder`
  Throws:
    `IOException`

### addCollationsToResponse

    protected void addCollationsToResponse(SolrParams params,
                                           SpellingResult spellingResult,
                                           ResponseBuilder rb,
                                           String q,
                                           NamedList response)

### getCustomParams

    protected SolrParams getCustomParams(String dictionary,
                                         SolrParams params,
                                         boolean shardRequest)

  For every param that is of the form "spellcheck.[dictionary name].XXXX=YYYY, add XXXX=YYYY as a param to the custom param list

  Parameters:
    `params` - The original SolrParams
  Returns:
    The new Params

### modifyRequest

    public void modifyRequest(ResponseBuilder rb,
                              SearchComponent who,
                              ShardRequest sreq)

  Description copied from class: `SearchComponent`
  Called after another component adds a request

  Overrides:
    `modifyRequest` in class `SearchComponent`

### finishStage

    public void finishStage(ResponseBuilder rb)

  Description copied from class: `SearchComponent`
  Called after all responses have been received for this stage. Useful when different requests are sent to each shard.

  Overrides:
    `finishStage` in class `SearchComponent`

### getSpellChecker

    protected SolrSpellChecker getSpellChecker(SolrParams params)

### getSpellChecker

    public SolrSpellChecker getSpellChecker(String name)

  Returns:
    the spellchecker registered to a given name

### toNamedList

    protected NamedList toNamedList(boolean shardRequest,
                                    SpellingResult spellingResult,
                                    String origQuery,
                                    boolean extendedResults,
                                    boolean collate)

### inform

    public void inform(SolrCore core)

  Specified by:
    `inform` in interface `SolrCoreAware`

### getSpellCheckers

    public Map<String,SolrSpellChecker> getSpellCheckers()

### getDescription

    public String getDescription()

  Description copied from interface: `SolrInfoMBean`
  Simple one or two line description

  Specified by:
    `getDescription` in interface `SolrInfoMBean`
  Specified by:
    `getDescription` in class `SearchComponent`

### getVersion

    public String getVersion()

  Description copied from interface: `SolrInfoMBean`
  Simple common usage version, e.g. 2.0

  Specified by:
    `getVersion` in interface `SolrInfoMBean`
  Specified by:
    `getVersion` in class `SearchComponent`

### getSourceId

    public String getSourceId()

  Description copied from interface: `SolrInfoMBean`
  CVS Id, SVN Id, etc

  Specified by:
    `getSourceId` in interface `SolrInfoMBean`
  Specified by:
    `getSourceId` in class `SearchComponent`

### getSource

    public String getSource()

  Description copied from interface: `SolrInfoMBean`
  CVS Source, SVN Source, etc

  Specified by:
    `getSource` in interface `SolrInfoMBean`
  Specified by:
    `getSource` in class `SearchComponent`

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