Package org.apache.solr.request
Class SolrQueryRequestBase
- java.lang.Object
-
- org.apache.solr.request.SolrQueryRequestBase
-
- All Implemented Interfaces:
Closeable,AutoCloseable,SolrQueryRequest
- Direct Known Subclasses:
LocalSolrQueryRequest
public abstract class SolrQueryRequestBase extends Object implements SolrQueryRequest, Closeable
Base implementation ofSolrQueryRequestthat provides some convenience methods for accessing parameters, and manages an IndexSearcher reference.The
close()method must be called on any instance of this class once it is no longer in use.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<Object,Object>contextprotected SolrCorecoreprotected Map<String,Object>jsonprotected org.apache.solr.common.params.SolrParamsorigParamsprotected org.apache.solr.common.params.SolrParamsparamsprotected IndexSchemaschemaprotected RefCounted<SolrIndexSearcher>searcherHolderprotected longstartTimeprotected Iterable<org.apache.solr.common.util.ContentStream>streams-
Fields inherited from interface org.apache.solr.request.SolrQueryRequest
ALLOW_PARTIAL_RESULTS_DEFAULT, SOLR_ALLOW_PARTIAL_RESULTS_DEFAULT
-
-
Constructor Summary
Constructors Constructor Description SolrQueryRequestBase(SolrCore core, org.apache.solr.common.params.SolrParams params)SolrQueryRequestBase(SolrCore core, org.apache.solr.common.params.SolrParams params, RTimerTree requestTimer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Frees resources associated with this request, this method must be called when the object is no longer in use.List<org.apache.solr.common.util.CommandOperation>getCommands(boolean validateInput)Only for v2 API if the request contains a command payload, it's parsed and returned as a list of CommandOperation objectsIterable<org.apache.solr.common.util.ContentStream>getContentStreams()A Collection of ContentStreams passed to the requestMap<Object,Object>getContext()Generic information associated with this request that may be both read and updated.SolrCoregetCore()The solr core (coordinator, etc) associated with this requestMap<String,Object>getJSON()Returns any associated JSON (or null if none) in deserialized generic form.org.apache.solr.common.params.SolrParamsgetOriginalParams()Returns the original request parameters.org.apache.solr.common.params.SolrParamsgetParams()returns the current request parametersStringgetParamString()Returns a string representing all the important parameters.RTimerTreegetRequestTimer()The timer for this request, created when the request started being processedIndexSchemagetSchema()The schema snapshot from core.getLatestSchema() at request creation.SolrIndexSearchergetSearcher()The index searcher associated with this requestio.opentracing.SpangetSpan()The distributed tracing Span for the request itself; never null.protected org.apache.solr.common.util.ValidatingJsonMapgetSpec()longgetStartTime()The start time of this request in milliseconds.io.opentracing.TracergetTracer()Distributed tracing Tracer.PrincipalgetUserPrincipal()protected Map<String,org.apache.solr.common.util.JsonSchemaValidator>getValidators()voidsetContentStreams(Iterable<org.apache.solr.common.util.ContentStream> s)voidsetJSON(Map<String,Object> json)voidsetParams(org.apache.solr.common.params.SolrParams params)Change the parameters for this request.StringtoString()voidupdateSchemaToLatest()Replaces the current schema snapshot with the latest from the core.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.solr.request.SolrQueryRequest
getCloudDescriptor, getCoreContainer, getHttpMethod, getHttpSolrCall, getPath, getPathTemplateValues, getResponseWriter, subRequest
-
-
-
-
Field Detail
-
core
protected final SolrCore core
-
origParams
protected final org.apache.solr.common.params.SolrParams origParams
-
schema
protected volatile IndexSchema schema
-
params
protected org.apache.solr.common.params.SolrParams params
-
streams
protected Iterable<org.apache.solr.common.util.ContentStream> streams
-
startTime
protected final long startTime
-
searcherHolder
protected RefCounted<SolrIndexSearcher> searcherHolder
-
-
Constructor Detail
-
SolrQueryRequestBase
public SolrQueryRequestBase(SolrCore core, org.apache.solr.common.params.SolrParams params, RTimerTree requestTimer)
-
SolrQueryRequestBase
public SolrQueryRequestBase(SolrCore core, org.apache.solr.common.params.SolrParams params)
-
-
Method Detail
-
getContext
public Map<Object,Object> getContext()
Description copied from interface:SolrQueryRequestGeneric information associated with this request that may be both read and updated.- Specified by:
getContextin interfaceSolrQueryRequest
-
getParams
public org.apache.solr.common.params.SolrParams getParams()
Description copied from interface:SolrQueryRequestreturns the current request parameters- Specified by:
getParamsin interfaceSolrQueryRequest
-
getOriginalParams
public org.apache.solr.common.params.SolrParams getOriginalParams()
Description copied from interface:SolrQueryRequestReturns the original request parameters. As this does not normally include configured defaults it's more suitable for logging.- Specified by:
getOriginalParamsin interfaceSolrQueryRequest
-
setParams
public void setParams(org.apache.solr.common.params.SolrParams params)
Description copied from interface:SolrQueryRequestChange the parameters for this request. This does not affect the original parameters returned by getOriginalParams()- Specified by:
setParamsin interfaceSolrQueryRequest
-
getStartTime
public long getStartTime()
Description copied from interface:SolrQueryRequestThe start time of this request in milliseconds. Use this only if you need the absolute system time at the start of the request, getRequestTimer() provides a more accurate mechanism for timing purposes.- Specified by:
getStartTimein interfaceSolrQueryRequest
-
getRequestTimer
public RTimerTree getRequestTimer()
Description copied from interface:SolrQueryRequestThe timer for this request, created when the request started being processed- Specified by:
getRequestTimerin interfaceSolrQueryRequest
-
getSearcher
public SolrIndexSearcher getSearcher()
Description copied from interface:SolrQueryRequestThe index searcher associated with this request- Specified by:
getSearcherin interfaceSolrQueryRequest
-
getCore
public SolrCore getCore()
Description copied from interface:SolrQueryRequestThe solr core (coordinator, etc) associated with this request- Specified by:
getCorein interfaceSolrQueryRequest
-
getSchema
public IndexSchema getSchema()
Description copied from interface:SolrQueryRequestThe schema snapshot from core.getLatestSchema() at request creation.- Specified by:
getSchemain interfaceSolrQueryRequest
-
getTracer
public io.opentracing.Tracer getTracer()
Description copied from interface:SolrQueryRequestDistributed tracing Tracer. Never null but might implementNoopTracer.- Specified by:
getTracerin interfaceSolrQueryRequest
-
getSpan
public io.opentracing.Span getSpan()
Description copied from interface:SolrQueryRequestThe distributed tracing Span for the request itself; never null. This is useful for adding tags or updating the operation name of the request span. If you need the current span, which might not necessarily be the request span, do this instead:tracer.activeSpan().- Specified by:
getSpanin interfaceSolrQueryRequest
-
updateSchemaToLatest
public void updateSchemaToLatest()
Description copied from interface:SolrQueryRequestReplaces the current schema snapshot with the latest from the core.- Specified by:
updateSchemaToLatestin interfaceSolrQueryRequest
-
close
public void close()
Frees resources associated with this request, this method must be called when the object is no longer in use.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceSolrQueryRequest
-
getContentStreams
public Iterable<org.apache.solr.common.util.ContentStream> getContentStreams()
A Collection of ContentStreams passed to the request- Specified by:
getContentStreamsin interfaceSolrQueryRequest
-
setContentStreams
public void setContentStreams(Iterable<org.apache.solr.common.util.ContentStream> s)
-
getParamString
public String getParamString()
Description copied from interface:SolrQueryRequestReturns a string representing all the important parameters. Suitable for logging.- Specified by:
getParamStringin interfaceSolrQueryRequest
-
getJSON
public Map<String,Object> getJSON()
Description copied from interface:SolrQueryRequestReturns any associated JSON (or null if none) in deserialized generic form. Java classes used to represent the JSON are as follows: Map, List, String, Long, Double, Boolean- Specified by:
getJSONin interfaceSolrQueryRequest
-
setJSON
public void setJSON(Map<String,Object> json)
- Specified by:
setJSONin interfaceSolrQueryRequest
-
getUserPrincipal
public Principal getUserPrincipal()
- Specified by:
getUserPrincipalin interfaceSolrQueryRequest
-
getCommands
public List<org.apache.solr.common.util.CommandOperation> getCommands(boolean validateInput)
Description copied from interface:SolrQueryRequestOnly for v2 API if the request contains a command payload, it's parsed and returned as a list of CommandOperation objects- Specified by:
getCommandsin interfaceSolrQueryRequest- Parameters:
validateInput- , If true it is validated against the json schema spec
-
getSpec
protected org.apache.solr.common.util.ValidatingJsonMap getSpec()
-
-