Package org.apache.solr.handler
Class RequestHandlerBase
- java.lang.Object
-
- org.apache.solr.handler.RequestHandlerBase
-
- All Implemented Interfaces:
ApiSupport
,SolrInfoBean
,NestedRequestHandler
,SolrMetricProducer
,SolrRequestHandler
- Direct Known Subclasses:
AnalysisRequestHandlerBase
,AutoScalingHandler
,AutoscalingHistoryHandler
,BlobHandler
,CdcrRequestHandler
,CollectionsHandler
,ConfigSetsHandler
,ContentStreamHandlerBase
,CoreAdminHandler
,DumpRequestHandler
,FileFloatSource.ReloadCacheRequestHandler
,GraphHandler
,HealthCheckHandler
,InfoHandler
,LoggingHandler
,LukeRequestHandler
,MetricsCollectorHandler
,MetricsHandler
,MetricsHistoryHandler
,MoreLikeThisHandler
,NotFoundRequestHandler
,PingRequestHandler
,PluginInfoHandler
,PropertiesRequestHandler
,PublicKeyHandler
,ReplicationHandler
,SchemaHandler
,SearchHandler
,SecurityConfHandler
,SegmentsInfoRequestHandler
,ShowFileRequestHandler
,SolrConfigHandler
,SolrInfoMBeanHandler
,SQLHandler
,StreamHandler
,SystemInfoHandler
,TaggerRequestHandler
,ThreadDumpHandler
,ZookeeperInfoHandler
,ZookeeperStatusHandler
public abstract class RequestHandlerBase extends Object implements SolrRequestHandler, SolrInfoBean, SolrMetricProducer, NestedRequestHandler, ApiSupport
-
-
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 SolrParams
appends
protected SolrParams
defaults
protected boolean
httpCaching
protected NamedList
initArgs
protected SolrParams
invariants
protected SolrMetricManager
metricManager
protected String
registryName
-
Fields inherited from interface org.apache.solr.request.SolrRequestHandler
TYPE
-
-
Constructor Summary
Constructors Constructor Description RequestHandlerBase()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description Collection<Api>
getApis()
It is possible to support multiple v2 apis by a single requesthandlerSolrInfoBean.Category
getCategory()
Category of this componentabstract String
getDescription()
Simple one or two line descriptionNamedList
getInitArgs()
Set<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.PluginInfo
getPluginInfo()
static SolrRequestHandler
getRequestHandler(String handlerName, PluginBag<SolrRequestHandler> reqHandlers)
Get the request handler registered to a given name.static SolrParams
getSolrParamsFromNamedList(NamedList args, String key)
SolrRequestHandler
getSubHandler(String subPath)
Return a RequestHandler to handle a subpath from the path this handler is registered.void
handleRequest(SolrQueryRequest req, SolrQueryResponse rsp)
Handles a query request, this method must be thread safe.abstract void
handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)
void
init(NamedList args)
Initializes theSolrRequestHandler
by creating threeSolrParams
named.void
initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Initializes metrics specific to this producervoid
setPluginInfo(PluginInfo pluginInfo)
-
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.api.ApiSupport
registerV1, registerV2
-
Methods inherited from interface org.apache.solr.core.SolrInfoBean
getMetricsSnapshot, registerMetricName
-
-
-
-
Field Detail
-
initArgs
protected NamedList initArgs
-
defaults
protected SolrParams defaults
-
appends
protected SolrParams appends
-
invariants
protected SolrParams invariants
-
httpCaching
protected boolean httpCaching
-
registryName
protected String registryName
-
metricManager
protected SolrMetricManager metricManager
-
-
Method Detail
-
init
public void init(NamedList args)
Initializes theSolrRequestHandler
by creating threeSolrParams
named.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". <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:
init
in interfaceSolrRequestHandler
- Parameters:
args
- TheNamedList
to initialize from- See Also:
handleRequest(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
,handleRequestBody(org.apache.solr.request.SolrQueryRequest, org.apache.solr.response.SolrQueryResponse)
,SolrPluginUtils.setDefaults(org.apache.solr.request.SolrQueryRequest, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams, org.apache.solr.common.params.SolrParams)
,See also the example solrconfig.xml located in the Solr codebase (example/solr/conf).
-
initializeMetrics
public void initializeMetrics(SolrMetricManager manager, String registryName, String tag, String scope)
Description copied from interface:SolrMetricProducer
Initializes metrics specific to this producer- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Parameters:
manager
- an instance ofSolrMetricManager
registryName
- registry name where metrics are registeredtag
- a symbolic tag that represents this instance of the producer, or a group of related instances that have the same life-cycle. This tag is used when managing life-cycle of some metrics and is set whenSolrMetricProducer.initializeMetrics(SolrMetricManager, String, String, String)
is called.scope
- scope of the metrics (eg. handler name) to separate metrics of
-
getSolrParamsFromNamedList
public static SolrParams getSolrParamsFromNamedList(NamedList args, String key)
-
getInitArgs
public NamedList getInitArgs()
-
handleRequestBody
public abstract void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
- Throws:
Exception
-
handleRequest
public void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp)
Description copied from interface:SolrRequestHandler
Handles a query request, this method must be thread safe.Information about the request may be obtained from
req
and 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:
handleRequest
in interfaceSolrRequestHandler
-
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
-
getSubHandler
public SolrRequestHandler getSubHandler(String subPath)
Description copied from interface:NestedRequestHandler
Return a RequestHandler to handle a subpath from the path this handler is registered.- Specified by:
getSubHandler
in 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
public void setPluginInfo(PluginInfo pluginInfo)
-
getPluginInfo
public PluginInfo getPluginInfo()
-
getApis
public Collection<Api> getApis()
Description copied from interface:ApiSupport
It is possible to support multiple v2 apis by a single requesthandler- Specified by:
getApis
in interfaceApiSupport
- Returns:
- the list of v2 api implementations
-
-