3

I have a content type called Basic Page with a few fields (title, description, page body), one of which (page body)is a field collection with a field called 'Section Body'. I created a view called Search Page that searches all my content (including other content types), then added my Field Collection Item datasource to my index and added the Section Body field (with type Fulltext) to the Fields section of my index.

After reindexing all of my content, I went to my view and added 'Field Collection Item >> Section Body' to the 'Search fields' section of my Fulltext search option in my view's Filter Options.

To test all this, I added in the unique term 'testterm123' to my content title, cleared the cache, and searched for the term. The test content returned successfully, so I know that the title is being searched for successfully. I repeated this process for description, and that worked as well. However, it did not work for my field collection field Section Body and nothing was returned.

So I'm confident that I indexed everything correctly, but the Field Collection field is not being searched. Has anyone run into this and if so, what did you do to fix it? Does anyone have any ideas on how to fix this or solutions to attempt?

3
+25

You shouldn't use the field collection module in D8 to begin with, as the project page says

enter image description here

and it also says

Drupal 8

Use Paragraphs and Entity Reference Revisions instead of field collection for Drupal 8 projects.

If you don't make the change now you will have to, in the future, whenever you migrate to D9 as there won't be any D9 version.

1
  • 2
    Sounds like they should migrate.
    – leymannx
    Nov 7 '20 at 7:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.