Class SearchHandler
- java.lang.Object
-
- org.apache.solr.handler.RequestHandlerBase
-
- org.apache.solr.handler.component.SearchHandler
-
- All Implemented Interfaces:
AutoCloseable
,ApiSupport
,SolrInfoBean
,NestedRequestHandler
,SolrMetricProducer
,SolrRequestHandler
,PermissionNameProvider
,PluginInfoInitialized
,SolrCoreAware
- Direct Known Subclasses:
ExportHandler
,RealTimeGetHandler
,StandardRequestHandler
public class SearchHandler extends RequestHandlerBase implements SolrCoreAware, PluginInfoInitialized, PermissionNameProvider
Refer SOLR-281
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.solr.handler.RequestHandlerBase
RequestHandlerBase.HandlerMetrics
-
Nested classes/interfaces inherited from interface org.apache.solr.security.PermissionNameProvider
PermissionNameProvider.Name
-
Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoBean
SolrInfoBean.Category, SolrInfoBean.Group
-
-
Field Summary
Fields Modifier and Type Field Description protected List<SearchComponent>
components
protected static String
SHARD_HANDLER_SUFFIX
-
Fields inherited from class org.apache.solr.handler.RequestHandlerBase
appends, defaults, httpCaching, initArgs, invariants, metrics, solrMetricsContext
-
Fields inherited from interface org.apache.solr.security.PermissionNameProvider
ANY, NULL, values
-
Fields inherited from interface org.apache.solr.request.SolrRequestHandler
TYPE
-
-
Constructor Summary
Constructors Constructor Description SearchHandler()
-
Method Summary
-
Methods inherited from class org.apache.solr.handler.RequestHandlerBase
getApis, getCategory, getInitArgs, getName, getPluginInfo, getRequestHandler, getSolrMetricsContext, getSolrParamsFromNamedList, getSubHandler, handleRequest, init, setPluginInfo
-
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
-
Methods inherited from interface org.apache.solr.metrics.SolrMetricProducer
close
-
-
-
-
Field Detail
-
SHARD_HANDLER_SUFFIX
protected static final String SHARD_HANDLER_SUFFIX
- See Also:
- Constant Field Values
-
components
protected volatile List<SearchComponent> components
-
-
Method Detail
-
init
public void init(PluginInfo info)
- Specified by:
init
in interfacePluginInfoInitialized
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducer
Initialize metrics specific to this producer.- Specified by:
initializeMetrics
in interfaceSolrMetricProducer
- Overrides:
initializeMetrics
in classRequestHandlerBase
- 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)
passingthis
as the child object.scope
- component scope
-
getMetricsForThisRequest
protected RequestHandlerBase.HandlerMetrics getMetricsForThisRequest(SolrQueryRequest req)
Description copied from class:RequestHandlerBase
The metrics to be used for this request.- Overrides:
getMetricsForThisRequest
in classRequestHandlerBase
-
getPermissionName
public PermissionNameProvider.Name getPermissionName(AuthorizationContext ctx)
- Specified by:
getPermissionName
in interfacePermissionNameProvider
-
inform
public void inform(SolrCore core)
Initialize the components based on name. Note, if usingINIT_FIRST_COMPONENTS
orINIT_LAST_COMPONENTS
, then theDebugComponent
will always occur last. If this is not desired, then one must explicitly declare all components using theINIT_COMPONENTS
syntax.- Specified by:
inform
in interfaceSolrCoreAware
-
getComponents
public List<SearchComponent> getComponents()
-
getAndPrepShardHandler
public ShardHandler getAndPrepShardHandler(SolrQueryRequest req, ResponseBuilder rb)
-
newResponseBuilder
protected ResponseBuilder newResponseBuilder(SolrQueryRequest req, SolrQueryResponse rsp, List<SearchComponent> components)
Override this method if you require a customResponseBuilder
e.g. for use by a customSearchComponent
.
-
handleRequestBody
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
- Specified by:
handleRequestBody
in classRequestHandlerBase
- Throws:
Exception
-
getOrGenerateRequestId
public static String getOrGenerateRequestId(SolrQueryRequest req)
Returns a String to use as an identifier for this request.If the provided
SolrQueryRequest
contains a non-blankCommonParams.REQUEST_ID
param value this is used. This is especially useful for users who deploy Solr as one component in a larger ecosystem, and want to use an external ID utilized by other components as well. If noCommonParams.REQUEST_ID
value is present, one is generated from scratch for the request.Callers are responsible for storing the returned value in the
SolrQueryRequest
object if they want to ensure that ID generation is not redone on subsequent calls.
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBean
Simple one or two line description- Specified by:
getDescription
in interfaceSolrInfoBean
- Specified by:
getDescription
in classRequestHandlerBase
-
registerV2
public Boolean registerV2()
Description copied from interface:ApiSupport
Whether this request handler must be made available at the /v2/ path- Specified by:
registerV2
in interfaceApiSupport
-
-