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 ofSolrQueryRequest
that 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>
context
protected SolrCore
core
protected Map<String,Object>
json
protected SolrParams
origParams
protected SolrParams
params
protected IndexSchema
schema
protected RefCounted<SolrIndexSearcher>
searcherHolder
protected long
startTime
protected Iterable<ContentStream>
streams
-
Constructor Summary
Constructors Constructor Description SolrQueryRequestBase(SolrCore core, SolrParams params)
SolrQueryRequestBase(SolrCore core, SolrParams params, RTimerTree requestTimer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Frees resources associated with this request, this method must be called when the object is no longer in use.List<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<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.SolrCore
getCore()
The solr core (coordinator, etc) associated with this requestMap<String,Object>
getJSON()
Returns any associated JSON (or null if none) in deserialized generic form.SolrParams
getOriginalParams()
Returns the original request parameters.SolrParams
getParams()
returns the current request parametersString
getParamString()
Returns a string representing all the important parameters.RTimerTree
getRequestTimer()
The timer for this request, created when the request started being processedIndexSchema
getSchema()
The schema snapshot from core.getLatestSchema() at request creation.SolrIndexSearcher
getSearcher()
The index searcher associated with this requestprotected ValidatingJsonMap
getSpec()
long
getStartTime()
The start time of this request in milliseconds.Principal
getUserPrincipal()
protected Map<String,JsonSchemaValidator>
getValidators()
void
setContentStreams(Iterable<ContentStream> s)
void
setJSON(Map<String,Object> json)
void
setParams(SolrParams params)
Change the parameters for this request.String
toString()
void
updateSchemaToLatest()
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
getHttpMethod, getHttpSolrCall, getPath, getPathTemplateValues
-
-
-
-
Field Detail
-
core
protected final SolrCore core
-
origParams
protected final SolrParams origParams
-
schema
protected volatile IndexSchema schema
-
params
protected SolrParams params
-
streams
protected Iterable<ContentStream> streams
-
startTime
protected final long startTime
-
searcherHolder
protected RefCounted<SolrIndexSearcher> searcherHolder
-
-
Constructor Detail
-
SolrQueryRequestBase
public SolrQueryRequestBase(SolrCore core, SolrParams params, RTimerTree requestTimer)
-
SolrQueryRequestBase
public SolrQueryRequestBase(SolrCore core, SolrParams params)
-
-
Method Detail
-
getContext
public Map<Object,Object> getContext()
Description copied from interface:SolrQueryRequest
Generic information associated with this request that may be both read and updated.- Specified by:
getContext
in interfaceSolrQueryRequest
-
getParams
public SolrParams getParams()
Description copied from interface:SolrQueryRequest
returns the current request parameters- Specified by:
getParams
in interfaceSolrQueryRequest
-
getOriginalParams
public SolrParams getOriginalParams()
Description copied from interface:SolrQueryRequest
Returns the original request parameters. As this does not normally include configured defaults it's more suitable for logging.- Specified by:
getOriginalParams
in interfaceSolrQueryRequest
-
setParams
public void setParams(SolrParams params)
Description copied from interface:SolrQueryRequest
Change the parameters for this request. This does not affect the original parameters returned by getOriginalParams()- Specified by:
setParams
in interfaceSolrQueryRequest
-
getStartTime
public long getStartTime()
Description copied from interface:SolrQueryRequest
The 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:
getStartTime
in interfaceSolrQueryRequest
-
getRequestTimer
public RTimerTree getRequestTimer()
Description copied from interface:SolrQueryRequest
The timer for this request, created when the request started being processed- Specified by:
getRequestTimer
in interfaceSolrQueryRequest
-
getSearcher
public SolrIndexSearcher getSearcher()
Description copied from interface:SolrQueryRequest
The index searcher associated with this request- Specified by:
getSearcher
in interfaceSolrQueryRequest
-
getCore
public SolrCore getCore()
Description copied from interface:SolrQueryRequest
The solr core (coordinator, etc) associated with this request- Specified by:
getCore
in interfaceSolrQueryRequest
-
getSchema
public IndexSchema getSchema()
Description copied from interface:SolrQueryRequest
The schema snapshot from core.getLatestSchema() at request creation.- Specified by:
getSchema
in interfaceSolrQueryRequest
-
updateSchemaToLatest
public void updateSchemaToLatest()
Description copied from interface:SolrQueryRequest
Replaces the current schema snapshot with the latest from the core.- Specified by:
updateSchemaToLatest
in 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:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceSolrQueryRequest
-
getContentStreams
public Iterable<ContentStream> getContentStreams()
A Collection of ContentStreams passed to the request- Specified by:
getContentStreams
in interfaceSolrQueryRequest
-
setContentStreams
public void setContentStreams(Iterable<ContentStream> s)
-
getParamString
public String getParamString()
Description copied from interface:SolrQueryRequest
Returns a string representing all the important parameters. Suitable for logging.- Specified by:
getParamString
in interfaceSolrQueryRequest
-
getJSON
public Map<String,Object> getJSON()
Description copied from interface:SolrQueryRequest
Returns 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:
getJSON
in interfaceSolrQueryRequest
-
setJSON
public void setJSON(Map<String,Object> json)
- Specified by:
setJSON
in interfaceSolrQueryRequest
-
getUserPrincipal
public Principal getUserPrincipal()
- Specified by:
getUserPrincipal
in interfaceSolrQueryRequest
-
getCommands
public List<CommandOperation> getCommands(boolean validateInput)
Description copied from interface:SolrQueryRequest
Only for v2 API if the request contains a command payload, it's parsed and returned as a list of CommandOperation objects- Specified by:
getCommands
in interfaceSolrQueryRequest
- Parameters:
validateInput
- , If true it is validated against the json schema spec
-
getSpec
protected ValidatingJsonMap getSpec()
-
getValidators
protected Map<String,JsonSchemaValidator> getValidators()
-
-