Class SearchComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- All Implemented Interfaces:
SolrInfoBean
,NamedListInitializedPlugin
- Direct Known Subclasses:
BlockJoinDocSetFacetComponent
,DebugComponent
,ExpandComponent
,FacetComponent
,FacetModule
,HighlightComponent
,MoreLikeThisComponent
,PhrasesIdentificationComponent
,QueryComponent
,QueryElevationComponent
,RealTimeGetComponent
,ResponseLogComponent
,SpellCheckComponent
,StatsComponent
,SuggestComponent
,TermsComponent
,TermVectorComponent
public abstract class SearchComponent extends Object implements SolrInfoBean, NamedListInitializedPlugin
TODO!- Since:
- solr 1.3
-
-
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 protected Set<String>
metricNames
protected com.codahale.metrics.MetricRegistry
registry
static Map<String,Class<? extends SearchComponent>>
standard_components
-
Constructor Summary
Constructors Constructor Description SearchComponent()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description int
distributedProcess(ResponseBuilder rb)
Process for a distributed search.void
finishStage(ResponseBuilder rb)
Called after all responses have been received for this stage.SolrInfoBean.Category
getCategory()
Category of this componentabstract String
getDescription()
Simple one or two line descriptionSet<String>
getMetricNames()
Modifiable set of metric names that this component reports (default is null, which means none).com.codahale.metrics.MetricRegistry
getMetricRegistry()
An instance ofMetricRegistry
that this component uses for metrics reporting (default is null, which means no registry).String
getName()
Simple common usage name, e.g.void
handleResponses(ResponseBuilder rb, ShardRequest sreq)
Called after all responses for a single request were receivedvoid
init(NamedList args)
void
modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq)
Called after another component adds a requestabstract void
prepare(ResponseBuilder rb)
Prepare the response.abstract void
process(ResponseBuilder rb)
Process the request for this componentvoid
setName(String name)
Sets the name of the SearchComponent.-
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
-
-
-
-
Method Detail
-
prepare
public abstract void prepare(ResponseBuilder rb) throws IOException
Prepare the response. Guaranteed to be called before any SearchComponentprocess(org.apache.solr.handler.component.ResponseBuilder)
method. Called for every incoming request. The place to do initialization that is request dependent.- Parameters:
rb
- TheResponseBuilder
- Throws:
IOException
- If there is a low-level I/O error.
-
process
public abstract void process(ResponseBuilder rb) throws IOException
Process the request for this component- Parameters:
rb
- TheResponseBuilder
- Throws:
IOException
- If there is a low-level I/O error.
-
distributedProcess
public int distributedProcess(ResponseBuilder rb) throws IOException
Process for a distributed search.- Returns:
- the next stage for this component
- Throws:
IOException
-
modifyRequest
public void modifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq)
Called after another component adds a request
-
handleResponses
public void handleResponses(ResponseBuilder rb, ShardRequest sreq)
Called after all responses for a single request were received
-
finishStage
public void finishStage(ResponseBuilder rb)
Called after all responses have been received for this stage. Useful when different requests are sent to each shard.
-
setName
public void setName(String name)
Sets the name of the SearchComponent. The name of the component is usually the name defined for it in the configuration.
-
init
public void init(NamedList args)
- Specified by:
init
in interfaceNamedListInitializedPlugin
-
getName
public String getName()
Description copied from interface:SolrInfoBean
Simple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getName
in interfaceSolrInfoBean
-
getDescription
public abstract String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBean
Category of this component- Specified by:
getCategory
in interfaceSolrInfoBean
-
getMetricNames
public Set<String> getMetricNames()
Description copied from interface:SolrInfoBean
Modifiable set of metric names that this component reports (default is null, which means none). If not null then this set is used bySolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.NOTE: this set has to allow iteration under modifications.
- Specified by:
getMetricNames
in interfaceSolrInfoBean
-
getMetricRegistry
public com.codahale.metrics.MetricRegistry getMetricRegistry()
Description copied from interface:SolrInfoBean
An instance ofMetricRegistry
that this component uses for metrics reporting (default is null, which means no registry).- Specified by:
getMetricRegistry
in interfaceSolrInfoBean
-
-