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>metricNamesprotected com.codahale.metrics.MetricRegistryregistrystatic 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 intdistributedProcess(ResponseBuilder rb)Process for a distributed search.voidfinishStage(ResponseBuilder rb)Called after all responses have been received for this stage.SolrInfoBean.CategorygetCategory()Category of this componentabstract StringgetDescription()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.MetricRegistrygetMetricRegistry()An instance ofMetricRegistrythat this component uses for metrics reporting (default is null, which means no registry).StringgetName()Simple common usage name, e.g.voidhandleResponses(ResponseBuilder rb, ShardRequest sreq)Called after all responses for a single request were receivedvoidinit(NamedList args)voidmodifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq)Called after another component adds a requestabstract voidprepare(ResponseBuilder rb)Prepare the response.abstract voidprocess(ResponseBuilder rb)Process the request for this componentvoidsetName(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:
initin interfaceNamedListInitializedPlugin
-
getName
public String getName()
Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getNamein interfaceSolrInfoBean
-
getDescription
public abstract String getDescription()
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean
-
getCategory
public SolrInfoBean.Category getCategory()
Description copied from interface:SolrInfoBeanCategory of this component- Specified by:
getCategoryin interfaceSolrInfoBean
-
getMetricNames
public Set<String> getMetricNames()
Description copied from interface:SolrInfoBeanModifiable 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:
getMetricNamesin interfaceSolrInfoBean
-
getMetricRegistry
public com.codahale.metrics.MetricRegistry getMetricRegistry()
Description copied from interface:SolrInfoBeanAn instance ofMetricRegistrythat this component uses for metrics reporting (default is null, which means no registry).- Specified by:
getMetricRegistryin interfaceSolrInfoBean
-
-