This document contains information about filtering search results with facets with the Apache Solr Search module.
Search facets enable users to refine or sort their search result set. Users can begin with a general search and narrow down the result set as they understand better what content is available on your website. This topic gives some examples about how to use search facets. For more information, see Configuring search facets.
- In the admin menu, select Structure.
- Click the Blocks link.
- In the list to the right of Facet API: Apache Solr environment: Acquia Search : Current Search, click Sidebar first.
- Click Save blocks.
The Current Search Blocks module is part of the Facets API module. For more information, see How do I use the new Current Search Blocks module? on Drupal.org.
Using facets in a search
If you search for “drupal” in the search box of the example website with Apache Solr search running, you receive 9107 results. The large number of results aren’t useful for most purposes.
Filtering with search facets lets users drill down into the results until they find what they’re looking for. You can see the Apache Solr search module displays the number of each content type in the initial search results.
Clicking on any term in a filter block narrows the search results to include only content that matches both the original and the newly selected search criteria. Narrowing the search to include only “Discussion” nodes reduces the result to 6034 nodes and adds “Discussion” to the facets list of the Current search block:
Users can add other search filters until they find what they’re looking for or run out of search results.
If you click the minus sign ( -
) link next to any search filter in a filter block, you remove the filter, which updates the search results to include all content matching the current filters.
Filter block results example
This block is configured to display the top ten node authors sorted by the number of nodes they have created:
Unless you change the default value, the Show more link at the bottom of the block displays 10 more authors (in order of contribution quantity) in the block list.