This module adds support to index multiple view mode renderings on an entity, instead of just one.
Configuration
There is very little to configuring this module. Enabling it will add a new data alteration callback in an index called "Multiple entity views". Select all the view modes in its option list for the indexed entity. When processing the data, Search API will render the entity item in each view mode, storing the rendered HTML as an item in your indexed record.
The advantage to this is that you can bypass hooking, loading, and rendering entities for data because you know they are already cached/stored in your result set. A good example of this would be a search form with search presentation(s) or entities rendered in sidebars, footers, or mobile devices.
How to Use
In your code, when dealing with a search response, there should be new fields returned. Each field will be called "view_mode_" with the view mode name affixed to the end.
For example, if you indexed Full, Search, List, and Mobile, you should see these in the results response per item:
- view_mode_full
- view_mode_search
- view_mode_list
- view_mode_mobile
Since this does render entities when processing, it is best to reduce the amount of items indexed per run to an acceptable limit based on your memory settings.
Views Integration
You can add the stored field to Views displays if your backend supports "Return all data' options (for example, Search API Solr). There is a custom handler for Views provided by this module that will show the result, including HTML.
Backend Support
So far, this module has been tested and known to work well with these backends:
- Apache Solr
- ElasticSearch
Drupal 7
If you are using Drupal 7, the version of this module is a port of Search API Solr Multiple View Modes with fixes to remove hard references to 'solr' - as this functionality can work with any backend.
Project information
- Module categories: Content Editing Experience, Content Display, Site Search
- 69 sites report using this module
- Created by kevinquillen on , updated
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.
Releases
Development version: 7.x-1.x-dev updated 6 Jul 2016 at 20:22 UTC