Facets
Facets let your visitors narrow down search results by clicking on categories, date ranges, price ranges, and other attributes. The module discovers available facets automatically from your Solr index.
Where to configure
Go to the Facet Mapping tab (/admin/config/search/opensolr/fields). This page has two sections.
Section 1: Field Mapping (Drupal fields → Solr)
This is where you map your Drupal fields to meta tags that the crawler can extract. For example, if you have a "Category" taxonomy field on your articles, you can map it so it becomes a filterable facet in search.
For each mapping, you fill in:
- Drupal Field β pick from a dropdown of all fields on your selected content types
- Meta Tag Name β a short name for the meta tag (e.g.,
category,author,color). Only lowercase letters, numbers, and underscores allowed. - Solr Type β how Solr should store this field:
- String (
_ss) β for text values like categories, tags, names. Use this for most fields. - Date (
_dt) β for date/time values - Float (
_f) β for decimal numbers like prices, ratings, percentages - Integer (
_i) β for whole numbers like page count, inventory
- String (
- Display Label β what visitors see on the search page (e.g., "Category", "Author"). Auto-generated if left blank.
Click "Add another mapping" to add more fields. Click "Remove" to delete a mapping.
After adding or changing field mappings, you need to Force Re-crawl All so the crawler picks up the new meta tags from your pages. New facets won't appear until pages are re-indexed.
Section 2: Facet Configuration
After the crawler has indexed your pages, this section shows a table of all available facet fields discovered from your Solr index.
For each field you can configure:
- Enable checkbox β turn this facet on or off on the search page
- Widget type β how the facet appears:
- List β checkboxes with values and counts (works for all field types)
- Min/Max Slider β a range slider for numeric fields (price, rating, etc.)
- Date Range Picker β calendar inputs for date fields
- Display Label β the heading shown above the facet on the search page
- Docs count β how many unique values exist for this field (read-only)
Reordering facets
There are two ways to control the display order of facets on the search page:
- In the admin table β drag the six-dot handle on each row to reorder facets. Weights update automatically.
- On the search page itself β when logged in as admin, you can drag facet groups in the sidebar to reorder them. The new order is saved via AJAX instantly.
Facet behavior on the search page
- List facets β click a value to filter by it. The value turns bold with an X to indicate it's active. Click the X to remove the filter.
- Slider facets β drag the min/max handles, then click "Apply". Click "Clear" to reset.
- Date facets β pick a "From" and "To" date, then click "Apply". Click "Clear" to reset.
Facets use Solr's tag/exclusion feature. When you select a facet value, the other values in that same facet group still show their full counts β not zeroed out. This lets visitors see all available options even when filtering.
Filtering within a facet
When a list facet has 10 or more values, a search box appears at the top of the facet. Visitors can type to filter the value list in real time. This is great for facets with many options like categories or brands.
Built-in facets (no mapping required)
Some fields are always available without any field mapping because the crawler extracts them automatically:
- Content type (
content_type) β MIME type (text/html, application/pdf, etc.) - Language (
meta_detected_language) β auto-detected page language - Creation date (
creation_date) β when the page was published - Price (
price_f) β extracted from structured data or meta tags - Sentiment (
sent_com) β auto-calculated sentiment score