Class SuggestComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- org.apache.solr.handler.component.SuggestComponent
-
- All Implemented Interfaces:
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 multipleSolrSuggester
to serve up suggestions Responsible for routing commands and queries to the appropriateSolrSuggester
and 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 String
COMPONENT_NAME
Name used to identify whether the user query concerns this componentprotected NamedList
initParams
protected SolrMetricManager
metricManager
protected String
registryName
protected Map<String,SolrSuggester>
suggesters
Key is the dictionary name used in SolrConfig, value is the correspondingSolrSuggester
-
Fields inherited from class org.apache.solr.handler.component.SearchComponent
metricNames, registry, 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 int
distributedProcess(ResponseBuilder rb)
Dispatch shard request inSTAGE_EXECUTE_QUERY
stagevoid
finishStage(ResponseBuilder rb)
Used in Distributed Search, merges the suggestion results from every shardCollection<org.apache.lucene.util.Accountable>
getChildResources()
String
getDescription()
Simple one or two line descriptionvoid
inform(SolrCore core)
void
init(NamedList args)
void
initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Initializes metrics specific to this producervoid
prepare(ResponseBuilder rb)
Responsible for issuing build and rebuild command to the specifiedSolrSuggester
void
process(ResponseBuilder rb)
Responsible for using the specified suggester to get the suggestions for the query and write the resultslong
ramBytesUsed()
-
Methods inherited from class org.apache.solr.handler.component.SearchComponent
getCategory, getMetricNames, getMetricRegistry, getName, 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.core.SolrInfoBean
getMetricsSnapshot, registerMetricName
-
-
-
-
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
-
metricManager
protected SolrMetricManager metricManager
-
registryName
protected String registryName
-
suggesters
protected Map<String,SolrSuggester> suggesters
Key is the dictionary name used in SolrConfig, value is the correspondingSolrSuggester
-
-
Method Detail
-
init
public void init(NamedList args)
- Specified by:
init
in interfaceNamedListInitializedPlugin
- Overrides:
init
in classSearchComponent
-
inform
public void inform(SolrCore core)
- Specified by:
inform
in interfaceSolrCoreAware
-
prepare
public void prepare(ResponseBuilder rb) throws IOException
Responsible for issuing build and rebuild command to the specifiedSolrSuggester
- Specified by:
prepare
in 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_QUERY
stage- Overrides:
distributedProcess
in 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:
process
in 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:
finishStage
in classSearchComponent
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
- Specified by:
getDescription
in classSearchComponent
-
initializeMetrics
public void initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Description copied from interface:SolrMetricProducer
Initializes metrics specific to this producer- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
manager
- an instance ofSolrMetricManager
registryName
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer, or a group of related instances that have the same life-cycle. This tag is used when managing life-cycle of some metrics and is set whenSolrMetricProducer.initializeMetrics(SolrMetricManager, String, String, String)
is called.scope
- scope of the metrics (eg. handler name) to separate metrics of
-
ramBytesUsed
public long ramBytesUsed()
- Specified by:
ramBytesUsed
in interfaceorg.apache.lucene.util.Accountable
-
getChildResources
public Collection<org.apache.lucene.util.Accountable> getChildResources()
- Specified by:
getChildResources
in interfaceorg.apache.lucene.util.Accountable
-
-