Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I have created a Field collection in one of my content types. The body and title fields of the content type are indexed just fine, but the content of the Field collection field is not. So if I run cron to index all nodes, and then search for a word in a field in the Field collection, the node doesn't show up in the search result. If I look in table search_dataset, the words from the Field collection field are also not present.
Is there any way to include Field collection fields in the search index?
Comments
Comment #1
phenaproximaI'd like this functionality as well. Is it just a matter of implementing the regular search hooks?
Comment #2
aendra CreditAttribution: aendra commentedI concur! Would love to use core search -- having to run a Solr server is so bad for memory...
Comment #3
ilpado CreditAttribution: ilpado commentednot even in beta 5 contents are searchable, you have solved in any way?
Comment #4
topdillon CreditAttribution: topdillon commentedFor what it's worth, there is an alpha mod if you are using SOLR.
Comment #5
peter_fanter CreditAttribution: peter_fanter commentedis there something similar for search api solr?
Comment #6
stevenlafl CreditAttribution: stevenlafl commentedDid anyone get anywhere with this? I want to be able to search and sort by these fields. Edit: you may be able to create a module that makes use of hook_node_update_index
Comment #7
vensires CreditAttribution: vensires commentedI don't know if this is still an issue in 7.x-1.0-beta10 but in case it helps anyone, a working scenario with core search module was the following:
For some reason, if the 3rd option (CJK handling) wasn't enabled, search didn't work for field collection items. Don't forget to clear caches and reindex.
PS: According to the Search interface documentation on drupal.org: "the search system already indexes all visible output of a node; i.e., everything displayed normally by hook_view() and hook_node_view(). This is usually sufficient". As a result, you'd better make also sure the node's search_index view mode properly displays all the field collection items.