Class SuggestComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- org.apache.solr.handler.component.SuggestComponent
-
- All Implemented Interfaces:
AutoCloseable,org.apache.lucene.util.Accountable,SolrInfoBean,SolrMetricProducer,SuggesterParams,NamedListInitializedPlugin,SolrCoreAware
public class SuggestComponent extends SearchComponent implements SolrCoreAware, SuggesterParams, org.apache.lucene.util.Accountable, SolrMetricProducer
SuggestComponent: interacts with multipleSolrSuggesterto serve up suggestions Responsible for routing commands and queries to the appropriateSolrSuggesterand for initializing them as specified by SolrConfig
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description static StringCOMPONENT_NAMEName used to identify whether the user query concerns this componentprotected org.apache.solr.common.util.NamedList<?>initParamsprotected Map<String,SolrSuggester>suggestersKey is the dictionary name used in SolrConfig, value is the correspondingSolrSuggester-
Fields inherited from class org.apache.solr.handler.component.SearchComponent
solrMetricsContext, 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 Description SuggestComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intdistributedProcess(ResponseBuilder rb)Dispatch shard request inSTAGE_EXECUTE_QUERYstagevoidfinishStage(ResponseBuilder rb)Used in Distributed Search, merges the suggestion results from every shardCollection<org.apache.lucene.util.Accountable>getChildResources()StringgetDescription()Simple one or two line descriptionvoidinform(SolrCore core)voidinit(org.apache.solr.common.util.NamedList<?> args)initwill be called just once, immediately after creation.voidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.voidprepare(ResponseBuilder rb)Responsible for issuing build and rebuild command to the specifiedSolrSuggestervoidprocess(ResponseBuilder rb)Responsible for using the specified suggester to get the suggestions for the query and write the resultslongramBytesUsed()-
Methods inherited from class org.apache.solr.handler.component.SearchComponent
getCategory, getName, getSolrMetricsContext, handleResponses, modifyRequest, setName
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close, getSolrMetricsContext
-
-
-
-
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 org.apache.solr.common.util.NamedList<?> initParams
-
suggesters
protected Map<String,SolrSuggester> suggesters
Key is the dictionary name used in SolrConfig, value is the correspondingSolrSuggester
-
-
Method Detail
-
init
public void init(org.apache.solr.common.util.NamedList<?> args)
Description copied from interface:NamedListInitializedPlugininitwill be called just once, immediately after creation.Source of the initialization arguments will typically be solrconfig.xml, but will ultimately depends on the plugin itself
- Specified by:
initin interfaceNamedListInitializedPlugin- Parameters:
args- non-null list of initialization parameters (may be empty)
-
inform
public void inform(SolrCore core)
- Specified by:
informin interfaceSolrCoreAware
-
prepare
public void prepare(ResponseBuilder rb) throws IOException
Responsible for issuing build and rebuild command to the specifiedSolrSuggester- Specified by:
preparein classSearchComponent- Parameters:
rb- TheResponseBuilder- Throws:
IOException- If there is a low-level I/O error.
-
distributedProcess
public int distributedProcess(ResponseBuilder rb)
Dispatch shard request inSTAGE_EXECUTE_QUERYstage- Overrides:
distributedProcessin classSearchComponent- 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:
processin classSearchComponent- Parameters:
rb- TheResponseBuilder- 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:
finishStagein classSearchComponent
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean- Specified by:
getDescriptionin classSearchComponent
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Overrides:
initializeMetricsin classSearchComponent- Parameters:
parentContext- parent metrics context. If this component has the same life-cycle as the parent it can simply use the parent context, otherwise it should obtain a child context usingSolrMetricsContext.getChildContext(Object)passingthisas the child object.scope- component scope
-
ramBytesUsed
public long ramBytesUsed()
- Specified by:
ramBytesUsedin interfaceorg.apache.lucene.util.Accountable
-
getChildResources
public Collection<org.apache.lucene.util.Accountable> getChildResources()
- Specified by:
getChildResourcesin interfaceorg.apache.lucene.util.Accountable
-
-