org.apache.solr.handler.component

## Class SuggestComponent

- java.lang.Object
- - org.apache.solr.handler.component.SearchComponent
  - - org.apache.solr.handler.component.SuggestComponent

- All Implemented Interfaces:
    Accountable, SolrInfoMBean, SuggesterParams, NamedListInitializedPlugin, SolrCoreAware

      public class SuggestComponent
      extends SearchComponent
      implements SolrCoreAware, SuggesterParams, Accountable

  SuggestComponent: interacts with multiple `SolrSuggester` to serve up suggestions Responsible for routing commands and queries to the appropriate `SolrSuggester` and for initializing them as specified by SolrConfig

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean

      `SolrInfoMBean.Category`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `COMPONENT_NAME` Name used to identify whether the user query concerns this component
    `protected NamedList` | `initParams`
    `protected Map<String,SolrSuggester>` | `suggesters` Key is the dictionary name used in SolrConfig, value is the corresponding `SolrSuggester`

    - ### Fields inherited from class org.apache.solr.handler.component.SearchComponent

      `standard_components`

    - ### Fields inherited from interface org.apache.solr.spelling.suggest.SuggesterParams

      `SUGGEST_ALL_TERMS_REQUIRED, SUGGEST_BUILD, SUGGEST_BUILD_ALL, SUGGEST_CONTEXT_FILTER_QUERY, SUGGEST_COUNT, SUGGEST_DICT, SUGGEST_HIGHLIGHT, SUGGEST_PREFIX, SUGGEST_Q, SUGGEST_RELOAD, SUGGEST_RELOAD_ALL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SuggestComponent()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `distributedProcess(ResponseBuilder rb)` Dispatch shard request in `STAGE_EXECUTE_QUERY` stage
    `void` | `finishStage(ResponseBuilder rb)` Used in Distributed Search, merges the suggestion results from every shard
    `Collection<Accountable>` | `getChildResources()`
    `String` | `getDescription()` Simple one or two line description
    `NamedList` | `getStatistics()` Any statistics this instance would like to be publicly available via the Solr Administration interface.
    `void` | `inform(SolrCore core)`
    `void` | `init(NamedList args)`
    `void` | `prepare(ResponseBuilder rb)` Responsible for issuing build and rebuild command to the specified `SolrSuggester`
    `void` | `process(ResponseBuilder rb)` Responsible for using the specified suggester to get the suggestions for the query and write the results
    `long` | `ramBytesUsed()`

    - ### Methods inherited from class org.apache.solr.handler.component.SearchComponent

      `getCategory, getDocs, getName, getSource, getVersion, handleResponses, modifyRequest, setName`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### COMPONENT_NAME

          public static final String COMPONENT_NAME

      Name used to identify whether the user query concerns this component
      See Also:
        Constant Field Values

    - #### initParams

          protected NamedList initParams

    - #### suggesters

          protected Map<String,SolrSuggester> suggesters

      Key is the dictionary name used in SolrConfig, value is the corresponding `SolrSuggester`

  - ### Constructor Detail

    - #### SuggestComponent

          public SuggestComponent()

  - ### Method Detail

    - #### init

          public void init(NamedList args)

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

    - #### inform

          public void inform(SolrCore core)

      Specified by:
        `inform` in interface `SolrCoreAware`

    - #### prepare

          public void prepare(ResponseBuilder rb)
                       throws IOException

      Responsible for issuing build and rebuild command to the specified `SolrSuggester`
      Specified by:
        `prepare` in class `SearchComponent`
      Parameters:
        `rb` - The `ResponseBuilder`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### distributedProcess

          public int distributedProcess(ResponseBuilder rb)

      Dispatch shard request in `STAGE_EXECUTE_QUERY` stage
      Overrides:
        `distributedProcess` in class `SearchComponent`
      Returns:
        the next stage for this component

    - #### process

          public void process(ResponseBuilder rb)
                       throws IOException

      Responsible for using the specified suggester to get the suggestions for the query and write the results
      Specified by:
        `process` in class `SearchComponent`
      Parameters:
        `rb` - The `ResponseBuilder`
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### finishStage

          public void finishStage(ResponseBuilder rb)

      Used in Distributed Search, merges the suggestion results from every shard
      Overrides:
        `finishStage` in class `SearchComponent`

    - #### 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`

    - #### getStatistics

          public NamedList getStatistics()

      Description copied from interface: `SolrInfoMBean`
      Any statistics this instance would like to be publicly available via the Solr Administration interface.

      Any Object type may be stored in the list, but only the `toString()` representation will be used.

      Specified by:
        `getStatistics` in interface `SolrInfoMBean`
      Overrides:
        `getStatistics` in class `SearchComponent`

    - #### ramBytesUsed

          public long ramBytesUsed()

      Specified by:
        `ramBytesUsed` in interface `Accountable`

    - #### getChildResources

          public Collection<Accountable> getChildResources()

      Specified by:
        `getChildResources` in interface `Accountable`

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.