requestDispatcher element of
solrconfig.xml controls the way the Solr HTTP
RequestDispatcher implementation responds to requests. Included are parameters for defining if it should handle
/select urls (for Solr 1.1 compatibility), if it will support remote streaming, the maximum size of file uploads and how it will respond to HTTP cache headers in requests.
handleSelect is for legacy back-compatibility; those new to Solr do not need to change anything about the way this is configured by default.
The first configurable item is the
handleSelect attribute on the
<requestDispatcher> element itself. This attribute can be set to one of two values, either "true" or "false". It governs how Solr responds to requests such as
/select?qt=XXX. The default value "false" will ignore requests to
/select if a requestHandler is not explicitly registered with the name
/select. A value of "true" will route query requests to the parser defined with the
In recent versions of Solr, a
/select requestHandler is defined by default, so a value of "false" will work fine. See the section RequestHandlers and SearchComponents in SolrConfig for more information.
<requestParsers> sub-element controls values related to parsing requests. This is an empty XML element that doesn't have any content, only attributes.
enableRemoteStreaming controls whether remote streaming of content is allowed. If set to
false, streaming will not be allowed. Setting it to
true (the default) lets you specify the location of content to be streamed using
If you enable remote streaming, be sure that you have authentication enabled. Otherwise, someone could potentially gain access to your content by accessing arbitrary URLs. It's also a good idea to place Solr behind a firewall to prevent it being accessed from untrusted clients.
multipartUploadLimitInKB sets an upper limit in kilobytes on the size of a document that may be submitted in a multi-part HTTP POST request. The value specified is multiplied by 1024 to determine the size in bytes.
formdataUploadLimitInKB sets a limit in kilobytes on the size of form data (application/x-www-form-urlencoded) submitted in a HTTP POST request, which can be used to pass request parameters that will not fit in a URL.
addHttpRequestToContext can be used to indicate that the original
HttpServletRequest object should be included in the context map of the
SolrQueryRequest using the key
HttpServletRequest is not used by any Solr component, but may be useful when developing custom plugins.
<httpCaching> element controls HTTP cache control headers. Do not confuse these settings with Solr's internal cache configuration. This element controls caching of HTTP responses as defined by the W3C HTTP specifications.
This element allows for three attributes and one sub-element. The attributes of the
<httpCaching> element control whether a 304 response to a GET request is allowed, and if so, what sort of response it should be. When an HTTP client application issues a GET, it may optionally specify that a 304 response is acceptable if the resource has not been modified since the last time it was fetched.
If present with the value
This attribute may be set to either
This value of this attribute is sent as the value of the
In addition to these attributes,
<httpCaching> accepts one child element:
<cacheControl>. The content of this element will be sent as the value of the Cache-Control header on HTTP responses. This header is used to modify the default caching behavior of the requesting client. The possible values for the Cache-Control header are defined by the HTTP 1.1 specification in Section 14.9.
Setting the max-age field controls how long a client may re-use a cached response before requesting it again from the server. This time interval should be set according to how often you update your index and whether or not it is acceptable for your application to use content that is somewhat out of date. Setting
must-revalidate will tell the client to validate with the server that its cached copy is still good before re-using it. This will ensure that the most timely result is used, while avoiding a second fetch of the content if it isn't needed, at the cost of a request to the server to do the check.