Class SearchComponent
- java.lang.Object
-
- org.apache.solr.handler.component.SearchComponent
-
- All Implemented Interfaces:
AutoCloseable,SolrInfoBean,SolrMetricProducer,NamedListInitializedPlugin
- Direct Known Subclasses:
ActiveTasksListComponent,DebugComponent,ExpandComponent,FacetComponent,FacetModule,HighlightComponent,MoreLikeThisComponent,PhrasesIdentificationComponent,QueryCancellationComponent,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 SolrMetricsContextsolrMetricsContextstatic 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 descriptionStringgetName()Simple common usage name, e.g.SolrMetricsContextgetSolrMetricsContext()Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component.voidhandleResponses(ResponseBuilder rb, ShardRequest sreq)Called after all responses for a single request were receivedvoidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.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.util.plugin.NamedListInitializedPlugin
init
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
-
-
-
Field Detail
-
solrMetricsContext
protected SolrMetricsContext solrMetricsContext
-
standard_components
public static final Map<String,Class<? extends SearchComponent>> standard_components
-
-
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.
-
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
-
getSolrMetricsContext
public SolrMetricsContext getSolrMetricsContext()
Description copied from interface:SolrMetricProducerImplementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, String)to ensure proper cleanup of metrics at the end of the life-cycle of this component. This should be the child context if one was created, or null if the parent context was used.- Specified by:
getSolrMetricsContextin interfaceSolrMetricProducer
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
initializeMetricsin interfaceSolrMetricProducer- 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
-
-