This module adds support to index multiple view mode renderings on an entity, instead of just one.
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:
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.
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.
So far, this module has been tested and known to work well with these backends:
- Apache Solr
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.
- Maintenance status: Actively maintained
- Development status: Under active development
- Module categories: Content, Content Display, Search, Views
- Reported installs: 61 sites currently report using this module. View usage statistics.
- Downloads: 1,109
- Last modified: June 3, 2016
- Stable releases for this project are covered by the security advisory policy.
Look for the shield icon below.