Solr now does faceted browsing out of the box

Whereas earlier versions required custom code, a recent addition to Solr enables faceted browsing out of the box.

For example, adding the following parameters to your query. assuming you have “category” and “inStock” fields in your data:

facet=true
facet.field=category
facet.field=inStock

Adds something like this to the search results:

<lst name="facet_counts">
<lst name="facet_queries"/>
<lst name="facet_fields">
<lst name="category">
<int name="music">1</int>
<int name="connector">2</int>
<int name="drive">21</int>
</lst>
<lst name="inStock">
<int name="false">3</int>
<int name="true">1</int>
</lst>
</lst>
</lst>

Showing which facets exist for the category and inStock fields, including result counts for each.

More details are available on the solr-user mailing list.

This is way cool, and comes right on time for my current project!

Comments are closed.

%d bloggers like this: