Package org.apache.solr.handler
Class RequestHandlerBase
java.lang.Object
org.apache.solr.handler.RequestHandlerBase
- All Implemented Interfaces:
AutoCloseable,ApiSupport,SolrInfoBean,NestedRequestHandler,SolrMetricProducer,SolrRequestHandler,PermissionNameProvider
- Direct Known Subclasses:
AnalysisRequestHandlerBase,CollectionsHandler,ConfigSetsHandler,ContentStreamHandlerBase,CoreAdminHandler,DumpRequestHandler,GraphHandler,HealthCheckHandler,InfoHandler,LoggingHandler,LukeRequestHandler,MetricsHandler,MoreLikeThisHandler,NotFoundRequestHandler,PingRequestHandler,PropertiesRequestHandler,PublicKeyHandler,ReplicationHandler,SchemaHandler,SearchHandler,SecurityConfHandler,SegmentsInfoRequestHandler,ShowFileRequestHandler,SolrConfigHandler,StreamHandler,SystemInfoHandler,TaggerRequestHandler,TaskManagementHandler,ThreadDumpHandler,ZookeeperInfoHandler,ZookeeperStatusHandler
public abstract class RequestHandlerBase
extends Object
implements SolrRequestHandler, SolrInfoBean, NestedRequestHandler, ApiSupport, PermissionNameProvider
Base class for all request handlers.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classMetrics for this handler.Nested classes/interfaces inherited from interface org.apache.solr.security.PermissionNameProvider
PermissionNameProvider.NameNested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanprotected org.apache.solr.common.params.SolrParamsprotected org.apache.solr.common.params.SolrParamsprotected booleanprotected org.apache.solr.common.util.NamedList<?> protected org.apache.solr.common.params.SolrParamsprotected RequestHandlerBase.HandlerMetricsprotected booleanstatic final Stringprotected SolrMetricsContextstatic final io.opentelemetry.api.common.AttributeKey<String> Fields inherited from interface org.apache.solr.security.PermissionNameProvider
ANY, NULL, valuesFields inherited from interface org.apache.solr.metrics.SolrMetricProducer
CATEGORY_ATTR, HANDLER_ATTR, NAME_ATTR, OPERATION_ATTR, PLUGIN_NAME_ATTR, RESULT_ATTR, TYPE_ATTRFields inherited from interface org.apache.solr.request.SolrRequestHandler
TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiongetApis()Returns any (non-JAX-RS annotated) APIs associated with this request handler.Category of this componentabstract StringSimple one or two line descriptionorg.apache.solr.common.util.NamedList<?> The metrics to be used for this request.getName()Simple common usage name, e.g.static SolrRequestHandlergetRequestHandler(String handlerName, PluginBag<SolrRequestHandler> reqHandlers) Get the request handler registered to a given name.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.static org.apache.solr.common.params.SolrParamsgetSolrParamsFromNamedList(org.apache.solr.common.util.NamedList<?> args, String key) getSubHandler(String subPath) Return a RequestHandler to handle a subpath from the path this handler is registered.voidhandleRequest(SolrQueryRequest req, SolrQueryResponse rsp) Handles a query request, this method must be thread safe.abstract voidvoidinit(org.apache.solr.common.util.NamedList<?> args) Initializes theSolrRequestHandlerby creating threeSolrParamsnamed.voidinitializeMetrics(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/componentstatic booleanChecks whether the given request is an internal request to a shard.static voidstatic ExceptionProcesses and normalizes any exceptions that are received from the request handler.voidsetPluginInfo(PluginInfo pluginInfo) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.solr.api.ApiSupport
getJerseyResources, registerV1, registerV2Methods inherited from interface org.apache.solr.security.PermissionNameProvider
getPermissionNameMethods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
Field Details
-
REQUEST_CPU_TIMER_CONTEXT
- See Also:
-
SOURCE_ATTR
-
initArgs
protected org.apache.solr.common.util.NamedList<?> initArgs -
defaults
protected org.apache.solr.common.params.SolrParams defaults -
appends
protected org.apache.solr.common.params.SolrParams appends -
invariants
protected org.apache.solr.common.params.SolrParams invariants -
httpCaching
protected boolean httpCaching -
aggregateNodeLevelMetricsEnabled
protected boolean aggregateNodeLevelMetricsEnabled -
solrMetricsContext
-
metrics
-
publishCpuTime
protected boolean publishCpuTime
-
-
Constructor Details
-
RequestHandlerBase
public RequestHandlerBase()
-
-
Method Details
-
init
public void init(org.apache.solr.common.util.NamedList<?> args) Initializes theSolrRequestHandlerby creating threeSolrParamsnamed.table of parameters Name Description defaults Contains all of the named arguments contained within the list element named "defaults". appends Contains all of the named arguments contained within the list element named "appends". invariants Contains all of the named arguments contained within the list element named "invariants". Example:
<lst name="defaults"> <str name="echoParams">explicit</str> <str name="qf">text^0.5 features^1.0 name^1.2 sku^1.5 id^10.0</str> <str name="mm">2<-1 5<-2 6<90%</str> <str name="bq">incubationdate_dt:[* TO NOW/DAY-1MONTH]^2.2</str> </lst> <lst name="appends"> <str name="fq">inStock:true</str> </lst> <lst name="invariants"> <str name="facet.field">cat</str> <str name="facet.field">manu_exact</str> <str name="facet.query">price:[* TO 500]</str> <str name="facet.query">price:[500 TO *]</str> </lst>
- Specified by:
initin interfaceSolrRequestHandler- Parameters:
args- TheNamedListto initialize from- See Also:
-
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
-
getSolrParamsFromNamedList
public static org.apache.solr.common.params.SolrParams getSolrParamsFromNamedList(org.apache.solr.common.util.NamedList<?> args, String key) -
getInitArgs
public org.apache.solr.common.util.NamedList<?> getInitArgs() -
handleRequestBody
public abstract void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception - Throws:
Exception
-
handleRequest
Description copied from interface:SolrRequestHandlerHandles a query request, this method must be thread safe.Information about the request may be obtained from
reqand response information may be set usingrsp.There are no mandatory actions that handleRequest must perform. An empty handleRequest implementation would fulfill all interface obligations.
- Specified by:
handleRequestin interfaceSolrRequestHandler
-
processErrorMetricsOnException
public static void processErrorMetricsOnException(Exception e, RequestHandlerBase.HandlerMetrics metrics) -
processReceivedException
Processes and normalizes any exceptions that are received from the request handler. This method is called before any error metrics are recorded.If a tragic exception occurred in the index writer, this method also gives up leadership of the shard, and replaces the index writer with a new one to attempt to get out of a transient failure (e.g. disk failure).
-
getMetricsForThisRequest
The metrics to be used for this request. -
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
-
getSubHandler
Description copied from interface:NestedRequestHandlerReturn a RequestHandler to handle a subpath from the path this handler is registered.- Specified by:
getSubHandlerin interfaceNestedRequestHandler
-
getRequestHandler
public static SolrRequestHandler getRequestHandler(String handlerName, PluginBag<SolrRequestHandler> reqHandlers) Get the request handler registered to a given name.This function is thread safe.
-
setPluginInfo
-
getPluginInfo
-
getApis
Description copied from interface:ApiSupportReturns any (non-JAX-RS annotated) APIs associated with this request handler.- Specified by:
getApisin interfaceApiSupport- See Also:
-
isInternalShardRequest
Checks whether the given request is an internal request to a shard. We rely on the fact that an internal search request to a shard contains the param "isShard", and an internal update request to a shard contains the param "distrib.from".- Returns:
- true if request is internal
-