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.

,price<br />

Faceted browsing is one of <strong>Solr</strong>'s key features. It allows users to narrow search results in ways that are<br />

meaningful to your application. For example, a shopping site could provide facets to narrow search results by<br />

manufacturer or price.<br />

Faceting information is returned as a third part of <strong>Solr</strong>'s query response. To get a taste of this power, take a look<br />

at the following query. It adds facet=true and facet.field=cat.<br />

http://localhost:8983/solr/gettingstarted/select?q=price:[0%20TO%20400]&fl=id,name<br />

,price&facet=true&facet.field=cat<br />

In addition to the familiar responseHeader and response from <strong>Solr</strong>, a facet_counts element is also present.<br />

Here is a view with the responseHeader and response collapsed so you can see the faceting information<br />

clearly.<br />

An XML Response with faceting<br />

<br />

<br />

...<br />

<br />

<br />

<br />

SOLR1000<br />

<strong>Solr</strong>, the Enterprise Search Server<br />

0.0<br />

...<br />

<br />

<br />

<br />

<br />

<br />

6<br />

3<br />

2<br />

2<br />

1<br />

1<br />

1<br />

1<br />

1<br />

1<br />

0<br />

0<br />

0<br />

0<br />

0<br />

<br />

<br />

<br />

<br />

<br />

<br />

The facet information shows how many of the query results have each possible value of the cat field. You could<br />

easily use this information to provide users with a quick way to narrow their query results. You can filter results<br />

by adding one or more filter queries to the <strong>Solr</strong> request. Here is a request further constraining the request to<br />

documents with a category of "software".<br />

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

11

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

Saved successfully!

Ooh no, something went wrong!