11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

own request handler, you should make sure it includes the ability to handle nested paths if you want to use them<br />

with your custom request handler.<br />

It is also possible to configure defaults for request handlers with a section called initParams. These defaults<br />

can be used when you want to have common properties that will be used by each separate handler. For<br />

example, if you intend to create several request handlers that will all request the same list of fields in the<br />

response, you can configure an initParams section with your list of fields. For more information about initPa<br />

rams, see the section InitParams in <strong>Solr</strong>Config.<br />

SearchHandlers<br />

The primary request handler defined with <strong>Solr</strong> by default is the "SearchHandler", which handles search queries.<br />

The request handler is defined, and then a list of defaults for the handler are defined with a defaults list.<br />

For example, in the default<br />

solrconfig.xml, the first request handler defined looks like this:<br />

<br />

<br />

explicit<br />

10<br />

<br />

<br />

This example defines the rows parameter, which defines how many search results to return, to "10". The echoP<br />

arams parameter defines that the parameters defined in the query should be returned when debug information is<br />

returned. Note also that the way the defaults are defined in the list varies if the parameter is a string, an integer,<br />

or another type.<br />

All of the parameters described in the section on searching can be defined as defaults for any of the<br />

SearchHandlers.<br />

Besides<br />

defaults, there are other options for the SearchHandler, which are:<br />

appends: This allows definition of parameters that are added to the user query. These might be filter<br />

queries, or other query rules that should be added to each query. There is no mechanism in <strong>Solr</strong> to allow<br />

a client to override these additions, so you should be absolutely sure you always want these parameters<br />

applied to queries.<br />

<br />

inStock:true<br />

<br />

In this example, the filter query "inStock:true" will always be added to every query.<br />

invariants: This allows definition of parameters that cannot be overridden by a client. The values<br />

defined in an invariants section will always be used regardless of the values specified by the user, by<br />

the client, in defaults or in appends.<br />

<br />

cat<br />

manu_exact<br />

price:[* TO 500]<br />

price:[500 TO *]<br />

<br />

In this example, facet fields have been defined which limits the facets that will be returned by <strong>Solr</strong>. If the<br />

<strong>Apache</strong> <strong>Solr</strong> <strong>Reference</strong> <strong>Guide</strong> <strong>6.0</strong><br />

445

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!