public abstract class RequestHandlerBase extends Object implements SolrRequestHandler, SolrInfoBean, SolrMetricProducer, NestedRequestHandler, ApiSupport
SolrInfoBean.Category, SolrInfoBean.Group| Modifier and Type | Field and Description |
|---|---|
protected SolrParams |
appends |
protected SolrParams |
defaults |
protected boolean |
httpCaching |
protected NamedList |
initArgs |
protected SolrParams |
invariants |
protected SolrMetricsContext |
solrMetricsContext |
TYPE| Constructor and Description |
|---|
RequestHandlerBase() |
| Modifier and Type | Method and Description |
|---|---|
Collection<Api> |
getApis()
It is possible to support multiple v2 apis by a single requesthandler
|
SolrInfoBean.Category |
getCategory()
Category of this component
|
abstract String |
getDescription()
Simple one or two line description
|
NamedList |
getInitArgs() |
Set<String> |
getMetricNames()
Modifiable set of metric names that this component reports (default is null,
which means none).
|
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.
|
SolrMetricsContext |
getSolrMetricsContext()
Implementing classes should override this method to provide the context obtained in
SolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component. |
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 the
SolrRequestHandler by creating three SolrParams named. |
void |
initializeMetrics(SolrMetricsContext parentContext,
String scope)
Initialize metrics specific to this producer.
|
void |
setPluginInfo(PluginInfo pluginInfo) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMetricRegistry, getMetricsSnapshot, registerMetricNameclose, getUniqueMetricTag, initializeMetricsregisterV1, registerV2protected NamedList initArgs
protected SolrParams defaults
protected SolrParams appends
protected SolrParams invariants
protected boolean httpCaching
protected SolrMetricsContext solrMetricsContext
public void init(NamedList args)
SolrRequestHandler by creating three SolrParams 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". |
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>
init in interface SolrRequestHandlerargs - The NamedList to initialize fromhandleRequest(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).
public SolrMetricsContext getSolrMetricsContext()
SolrMetricProducerSolrMetricProducer.initializeMetrics(SolrMetricsContext, String) to ensure proper cleanup of metrics
at the end of the life-cycle of this component.getSolrMetricsContext in interface SolrMetricProducerpublic void initializeMetrics(SolrMetricsContext parentContext, String scope)
SolrMetricProducerinitializeMetrics in interface SolrMetricProducerparentContext - 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
using SolrMetricsContext.getChildContext(Object) passing this
as the child.scope - component scopepublic static SolrParams getSolrParamsFromNamedList(NamedList args, String key)
public NamedList getInitArgs()
public abstract void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
Exceptionpublic void handleRequest(SolrQueryRequest req, SolrQueryResponse rsp)
SolrRequestHandler
Information about the request may be obtained from req and
response information may be set using rsp.
There are no mandatory actions that handleRequest must perform. An empty handleRequest implementation would fulfill all interface obligations.
handleRequest in interface SolrRequestHandlerpublic String getName()
SolrInfoBeangetName in interface SolrInfoBeanpublic abstract String getDescription()
SolrInfoBeangetDescription in interface SolrInfoBeanpublic SolrInfoBean.Category getCategory()
SolrInfoBeangetCategory in interface SolrInfoBeanpublic Set<String> getMetricNames()
SolrInfoBeanSolrInfoBean.registerMetricName(String)
to capture what metrics names are reported from this component.
NOTE: this set has to allow iteration under modifications.
getMetricNames in interface SolrInfoBeanpublic SolrRequestHandler getSubHandler(String subPath)
NestedRequestHandlergetSubHandler in interface NestedRequestHandlerpublic static SolrRequestHandler getRequestHandler(String handlerName, PluginBag<SolrRequestHandler> reqHandlers)
This function is thread safe.
public void setPluginInfo(PluginInfo pluginInfo)
public PluginInfo getPluginInfo()
public Collection<Api> getApis()
ApiSupportgetApis in interface ApiSupportCopyright © 2000-2020 Apache Software Foundation. All Rights Reserved.