Package org.apache.solr.request
Interface SolrQueryRequest
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DelegatingSolrQueryRequest,LocalSolrQueryRequest,SolrQueryRequestBase
public interface SolrQueryRequest extends AutoCloseable
Container for a request to execute a query.SolrQueryRequestis not thread safe.
-
-
Field Summary
Fields Modifier and Type Field Description static booleanALLOW_PARTIAL_RESULTS_DEFAULTUsers can setSOLR_ALLOW_PARTIAL_RESULTS_DEFAULTsystem property to true, and solr will omit results when any shard fails due query execution limits (time, cpu etc.).static StringSOLR_ALLOW_PARTIAL_RESULTS_DEFAULTThis is the system property forALLOW_PARTIAL_RESULTS_DEFAULT
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description static booleanallowPartialResults(org.apache.solr.common.params.SolrParams params)Tests if the partials for the request should be discarded.voidclose()This method should be called when all uses of this request are finished, so that resources can be freed.static booleandisallowPartialResults(org.apache.solr.common.params.SolrParams params)default CloudDescriptorgetCloudDescriptor()Deprecated.use getCore().getCoreDescriptor().getCloudDescriptor()default 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 requestdefault CoreContainergetCoreContainer()default StringgetHttpMethod()default HttpSolrCallgetHttpSolrCall()Map<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.default StringgetPath()default Map<String,String>getPathTemplateValues()Only for V2 API.RTimerTreegetRequestTimer()The timer for this request, created when the request started being processeddefault QueryResponseWritergetResponseWriter()The writer to use for this request, consideringCommonParams.WT.IndexSchemagetSchema()The schema snapshot from core.getLatestSchema() at request creation.SolrIndexSearchergetSearcher()The index searcher associated with this requestdefault io.opentracing.SpangetSpan()The distributed tracing Span for the request itself; never null.longgetStartTime()The start time of this request in milliseconds.default io.opentracing.TracergetTracer()Distributed tracing Tracer.PrincipalgetUserPrincipal()voidsetJSON(Map<String,Object> json)voidsetParams(org.apache.solr.common.params.SolrParams params)Change the parameters for this request.default SolrQueryRequestsubRequest(org.apache.solr.common.params.SolrParams params)Returns a new "Sub Request" of the current request.voidupdateSchemaToLatest()Replaces the current schema snapshot with the latest from the core.static SolrQueryRequestwrapSearcher(SolrIndexSearcher searcher, org.apache.solr.common.params.SolrParams params)Returns a request that explicitly uses the specifiedSolrIndexSearcher(even if it is not registered or fully initialized) in conjunction with theSolrCoreidentified viaSolrIndexSearcher.getCore()
-
-
-
Field Detail
-
SOLR_ALLOW_PARTIAL_RESULTS_DEFAULT
static final String SOLR_ALLOW_PARTIAL_RESULTS_DEFAULT
This is the system property forALLOW_PARTIAL_RESULTS_DEFAULT- See Also:
- Constant Field Values
-
ALLOW_PARTIAL_RESULTS_DEFAULT
static final boolean ALLOW_PARTIAL_RESULTS_DEFAULT
Users can setSOLR_ALLOW_PARTIAL_RESULTS_DEFAULTsystem property to true, and solr will omit results when any shard fails due query execution limits (time, cpu etc.). By default, this is set to true. Setting it to false will reduce processing, cpu and network associated with collecting and transmitting partial results. This setting can be overridden (in either direction) on a per-request basis with&allowPartialResults=[true|false]. When results have been omitted the response header should contain a partialResults element with the value "omitted"
-
-
Method Detail
-
allowPartialResults
static boolean allowPartialResults(org.apache.solr.common.params.SolrParams params)
Tests if the partials for the request should be discarded. ExaminesALLOW_PARTIAL_RESULTS_DEFAULTsystem property and also examinesCommonParams.PARTIAL_RESULTSrequest param. The Request Parameter takes precedence if both are set.- Parameters:
params- the request parameters- Returns:
- true if partials should be discarded.
-
disallowPartialResults
static boolean disallowPartialResults(org.apache.solr.common.params.SolrParams params)
-
getParams
org.apache.solr.common.params.SolrParams getParams()
returns the current request parameters
-
setParams
void setParams(org.apache.solr.common.params.SolrParams params)
Change the parameters for this request. This does not affect the original parameters returned by getOriginalParams()
-
getContentStreams
Iterable<org.apache.solr.common.util.ContentStream> getContentStreams()
A Collection of ContentStreams passed to the request
-
getOriginalParams
org.apache.solr.common.params.SolrParams getOriginalParams()
Returns the original request parameters. As this does not normally include configured defaults it's more suitable for logging.
-
getContext
Map<Object,Object> getContext()
Generic information associated with this request that may be both read and updated.
-
close
void close()
This method should be called when all uses of this request are finished, so that resources can be freed.- Specified by:
closein interfaceAutoCloseable
-
getStartTime
long getStartTime()
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.
-
getRequestTimer
RTimerTree getRequestTimer()
The timer for this request, created when the request started being processed
-
getSearcher
SolrIndexSearcher getSearcher()
The index searcher associated with this request
-
getCore
SolrCore getCore()
The solr core (coordinator, etc) associated with this request
-
getSchema
IndexSchema getSchema()
The schema snapshot from core.getLatestSchema() at request creation.
-
updateSchemaToLatest
void updateSchemaToLatest()
Replaces the current schema snapshot with the latest from the core.
-
getParamString
String getParamString()
Returns a string representing all the important parameters. Suitable for logging.
-
getJSON
Map<String,Object> getJSON()
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
-
getUserPrincipal
Principal getUserPrincipal()
-
getPath
default String getPath()
-
getPathTemplateValues
default Map<String,String> getPathTemplateValues()
Only for V2 API. Returns a map of path segments and their values. For example, if the path is configured as /path/{segment1}/{segment2} and a reguest is made as /path/x/y the returned map would contain {segment1:x ,segment2:y}
-
getCommands
default 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 objects- Parameters:
validateInput- , If true it is validated against the json schema spec
-
getHttpMethod
default String getHttpMethod()
-
getHttpSolrCall
default HttpSolrCall getHttpSolrCall()
-
getTracer
default io.opentracing.Tracer getTracer()
Distributed tracing Tracer. Never null but might implementNoopTracer.
-
getSpan
default io.opentracing.Span getSpan()
The 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().
-
getCoreContainer
default CoreContainer getCoreContainer()
-
getCloudDescriptor
@Deprecated default CloudDescriptor getCloudDescriptor()
Deprecated.use getCore().getCoreDescriptor().getCloudDescriptor()
-
getResponseWriter
default QueryResponseWriter getResponseWriter()
The writer to use for this request, consideringCommonParams.WT. Never null.
-
subRequest
default SolrQueryRequest subRequest(org.apache.solr.common.params.SolrParams params)
Returns a new "Sub Request" of the current request.This is useful in situations where some code handling an existing request wishes to invoke a new request -- as if it came from the same user. The request returned uses the same
getSearcher()andgetUserPrincipal()as the current request, and is initialized using the samegetSchema()(butupdateSchemaToLatest()is handled independently for the two requests)The behavior of a sub-request is undefined if the original request is closed.
-
wrapSearcher
static SolrQueryRequest wrapSearcher(SolrIndexSearcher searcher, org.apache.solr.common.params.SolrParams params)
Returns a request that explicitly uses the specifiedSolrIndexSearcher(even if it is not registered or fully initialized) in conjunction with theSolrCoreidentified viaSolrIndexSearcher.getCore()
-
-