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>componentsprotected static StringSHARD_HANDLER_SUFFIX-
Fields inherited from class org.apache.solr.handler.RequestHandlerBase
aggregateNodeLevelMetricsEnabled, 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancheckCircuitBreakers(SolrQueryRequest req, SolrQueryResponse rsp, ResponseBuilder rb)Check ifSolrRequest.SolrRequestType.QUERYcircuit breakers are tripped.ShardHandlergetAndPrepShardHandler(SolrQueryRequest req, ResponseBuilder rb)List<SearchComponent>getComponents()protected List<String>getDefaultComponents()StringgetDescription()Simple one or two line descriptionRequestHandlerBase.HandlerMetricsgetMetricsForThisRequest(SolrQueryRequest req)The metrics to be used for this request.static StringgetOrGenerateRequestId(SolrQueryRequest req)Returns a String to use as an identifier for this request.PermissionNameProvider.NamegetPermissionName(AuthorizationContext ctx)voidhandleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp)voidinform(SolrCore core)Initialize the components based on name.voidinit(PluginInfo info)voidinitializeMetrics(SolrMetricsContext parentContext, String scope)Initialize metrics specific to this producer.protected ResponseBuildernewResponseBuilder(SolrQueryRequest req, SolrQueryResponse rsp, List<SearchComponent> components)Override this method if you require a customResponseBuildere.g.BooleanregisterV2()Whether this request handler must be made available at the /v2/ path-
Methods inherited from class org.apache.solr.handler.RequestHandlerBase
getApis, getCategory, getInitArgs, getName, getPluginInfo, getRequestHandler, getSolrMetricsContext, getSolrParamsFromNamedList, getSubHandler, handleRequest, init, isInternalShardRequest, normalizeReceivedException, processErrorMetricsOnException, 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
getJerseyResources, 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:
initin interfacePluginInfoInitialized
-
initializeMetrics
public void initializeMetrics(SolrMetricsContext parentContext, String scope)
Description copied from interface:SolrMetricProducerInitialize metrics specific to this producer.- Specified by:
initializeMetricsin interfaceSolrMetricProducer- Overrides:
initializeMetricsin 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)passingthisas the child object.scope- component scope
-
getMetricsForThisRequest
public RequestHandlerBase.HandlerMetrics getMetricsForThisRequest(SolrQueryRequest req)
Description copied from class:RequestHandlerBaseThe metrics to be used for this request.- Overrides:
getMetricsForThisRequestin classRequestHandlerBase
-
getPermissionName
public PermissionNameProvider.Name getPermissionName(AuthorizationContext ctx)
- Specified by:
getPermissionNamein interfacePermissionNameProvider
-
inform
public void inform(SolrCore core)
Initialize the components based on name. Note, if usingINIT_FIRST_COMPONENTSorINIT_LAST_COMPONENTS, then theDebugComponentwill always occur last. If this is not desired, then one must explicitly declare all components using theINIT_COMPONENTSsyntax.- Specified by:
informin 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 customResponseBuildere.g. for use by a customSearchComponent.
-
checkCircuitBreakers
protected boolean checkCircuitBreakers(SolrQueryRequest req, SolrQueryResponse rsp, ResponseBuilder rb)
Check ifSolrRequest.SolrRequestType.QUERYcircuit breakers are tripped. Override this method in sub classes that do not want to check circuit breakers.- Returns:
- true if circuit breakers are tripped, false otherwise.
-
handleRequestBody
public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) throws Exception
- Specified by:
handleRequestBodyin classRequestHandlerBase- Throws:
Exception
-
getOrGenerateRequestId
public static String getOrGenerateRequestId(SolrQueryRequest req)
Returns a String to use as an identifier for this request.If the provided
SolrQueryRequestcontains a non-blankCommonParams.REQUEST_IDparam 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_IDvalue is present, one is generated from scratch for the request.Callers are responsible for storing the returned value in the
SolrQueryRequestobject if they want to ensure that ID generation is not redone on subsequent calls.
-
getDescription
public String getDescription()
Description copied from interface:SolrInfoBeanSimple one or two line description- Specified by:
getDescriptionin interfaceSolrInfoBean- Specified by:
getDescriptionin classRequestHandlerBase
-
registerV2
public Boolean registerV2()
Description copied from interface:ApiSupportWhether this request handler must be made available at the /v2/ path- Specified by:
registerV2in interfaceApiSupport
-
-