facets_attachment_display
Facets Attachment Display extends Drupal's search capabilities by allowing Views attachment displays to be used as facet sources. While standard Drupal setups only allow facets to be associated with main Views displays (pages, blocks), this module enables you to add facets to search results displayed through Views attachments, creating more flexible and powerful search interfaces.
Features
- Enables Views attachment displays as valid facet sources in the Search API ecosystem
- Allows independent filtering of attachment display results using facets
- Seamlessly integrates with existing Search API and Facets infrastructure
- Supports complex search interfaces with multiple result sections
- Maintains the same familiar facet configuration workflow
- Works with any Search API backend (Solr, Database, Elasticsearch, etc.)
Post-Installation
After installing the module:
- Create or edit a View that uses a Search API index as its base
- Set up a main display (page, block) and add an attachment display to it
- Configure both displays to use the Search API query type
- Go to the Facets administration page (
/admin/config/search/facets) and click "Add facet" - In the "Facet source" dropdown, you'll now see your attachment display listed as "Views attachment: [view_name]__[display_id]"
- Select this facet source and configure your facet as needed
- Place the facet block in your desired region
No additional configuration is required at the module level - it works automatically once enabled.
Additional Requirements
- Drupal core 11.x
- Search API module
- Facets module
- Views module (included in Drupal core)
Recommended modules/libraries
- Search API Solr or another Search API backend for production environments
- Facets Pretty Paths for improved URL handling with facets
- Search API Autocomplete to enhance the search experience
Similar projects
While several modules extend Facets functionality, Facets Attachment Display is unique in its focus on Views attachment displays. The core Facets module supports regular Views displays, but not attachments. This module fills that specific gap in the Search API ecosystem.
Additional Information
Technical Implementation
The module works by registering a new Search API display plugin type (views_attachment) and implementing hooks to detect when a Views attachment display is being rendered. It then registers the attachment as a Search API display if it's attached to a display that uses Search API.
Troubleshooting
If your attachment display is not appearing as a facet source:
- Ensure both the parent display and the attachment display use the Search API query type
- Verify that the attachment display is properly configured to be attached to a main display
- Clear the Drupal cache to ensure all plugin definitions are refreshed