Indexing Specific Field Collection Fields in Apache Solr for Drupal 7

I’m not sure how much of this is possible without Display Suite, but here’s the setup I’ve used to index specific fields within a field collection as part of the parent entity. I use the “Search index” view mode to specify which fields I want to index on each content type. Here’s what that looks like:

2016-07-21_08-14-15

As you can see, the “Versions” field and the “Associated people / organizations” field are field collections. In this example I only wanted to index a couple of fields from the “Versions” field collection as part of the search index for each “Book” node. In the screenshot above I’m telling the system to index the field collection items using the field collection item view mode of “Field collection search index”. This is a view mode that I had to create (because “Search index” isn’t available for field collection items under their “Manage Display” tab).

Adding this additional view mode is easy (with Display Suite, anyways):

2016-07-21_08-41-14

2016-07-21_08-42-32

After adding that view mode it appears as a choice in the Manage Display pane. After enabling (default tab, scroll to bottom, open “Custom display settings”) you can simply include the fields you want with the settings you want.

2016-07-21_08-20-24

After updating these display modes you’ll want to “Queue all content for reindexing” and then “Index all queued content” in the Apache Solr Search settings page. You should also clear all caches after indexing and processing are complete.

That’s all there is to it!

Tagged with: , ,
Posted in Development

Leave a Reply

Your email address will not be published. Required fields are marked *

*