11.05.2016 Views

Apache Solr Reference Guide Covering Apache Solr 6.0

21SiXmO

21SiXmO

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

example configuration below, clients can optionally specify the custom parameters in_stock and shipping to<br />

override the default filtering behavior, but are limited to the specific set of legal values (shipping=any|free,<br />

in_stock=yes|no|all).<br />

<br />

<br />

yes<br />

any<br />

<br />

<br />

{!switch case.all='*:*'<br />

case.yes='inStock:true'<br />

case.no='inStock:false'<br />

v=$in_stock}<br />

{!switch case.any='*:*'<br />

case.free='shipping_cost:0.0'<br />

v=$shipping}<br />

<br />

<br />

Term Query Parser<br />

TermQParser extends the QParserPlugin by creating a single term query from the input value equivalent to r<br />

eadableToIndexed(). This is useful for generating filter queries from the external human readable terms<br />

returned by the faceting or terms components. The only parameter is f, for the field.<br />

Example:<br />

{!term f=weight}1.5<br />

For text fields, no analysis is done since raw terms are already returned from the faceting and terms<br />

components. To apply analysis to text fields as well, see the Field Query Parser, above.<br />

If no analysis or transformation is desired for any type of field, see the<br />

Raw Query Parser, above.<br />

Terms Query Parser<br />

TermsQParser, functions similarly to the Term Query Parser but takes in multiple values separated by commas<br />

and returns documents matching any of the specified values. This can be useful for generating filter queries<br />

from the external human readable terms returned by the faceting or terms components, and may be more<br />

efficient in some cases than using the Standard Query Parser to generate an boolean query since the default<br />

implementation " method" avoids scoring.<br />

This query parser takes the following parameters:<br />

Parameter<br />

Description<br />

f<br />

separator<br />

The field on which to search. Required.<br />

Separator to use when parsing the input. If set to " " (a single blank space), will trim additional<br />

white space from the input terms. Defaults to ",".<br />

method The internal implementation to requested for building the query: termsFilter,<br />

booleanQuery<br />

, automaton, or docValuesTermsFilter. Defaults to " termsFilter".<br />

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

293

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

Saved successfully!

Ooh no, something went wrong!