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
FieldsModifier and TypeFieldDescriptionprotected SolrMetricsContextstatic final Map<String, Class<? extends SearchComponent>> Fields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTR -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintProcess for a distributed search.voidCalled after all responses have been received for this stage.Category of this componentabstract StringSimple one or two line descriptiongetName()Simple common usage name, e.g.Implementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, Attributes)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, io.opentelemetry.api.common.Attributes attributes) Implementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/componentvoidmodifyRequest(ResponseBuilder rb, SearchComponent who, ShardRequest sreq) Called after another component adds a requestabstract voidPrepare the response.abstract voidProcess the request for this componentvoidSets the name of the SearchComponent.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.util.plugin.NamedListInitializedPlugin
initMethods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
Field Details
-
solrMetricsContext
-
standard_components
-
-
Constructor Details
-
SearchComponent
public SearchComponent()
-
-
Method Details
-
prepare
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
Process the request for this component- Parameters:
rb- TheResponseBuilder- Throws:
IOException- If there is a low-level I/O error.
-
distributedProcess
Process for a distributed search.- Returns:
- the next stage for this component
- Throws:
IOException
-
modifyRequest
Called after another component adds a request -
handleResponses
Called after all responses for a single request were received -
finishStage
Called after all responses have been received for this stage. Useful when different requests are sent to each shard. -
setName
Sets the name of the SearchComponent. The name of the component is usually the name defined for it in the configuration. -
getName
Description copied from interface:SolrInfoBeanSimple common usage name, e.g. BasicQueryHandler, or fully qualified class name.- Specified by:
getNamein interfaceSolrInfoBean
-
getDescription
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean
-
getCategory
Description copied from interface:SolrInfoBeanCategory of this component- Specified by:
getCategoryin interfaceSolrInfoBean
-
getSolrMetricsContext
Description copied from interface:SolrMetricProducerImplementations should return the context used inSolrMetricProducer.initializeMetrics(SolrMetricsContext, Attributes)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, io.opentelemetry.api.common.Attributes attributes) Description copied from interface:SolrMetricProducerImplementation should initialize all metrics to aSolrMetricsContextRegistry/MeterProvider withAttributesas the common set of attributes that will be attached to every metric that is initialized for that class/component- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Parameters:
parentContext- The registry that the component will initialize metrics toattributes- Base set of attributes that will be bound to all metrics for that component
-