Search API with Field Collections

931 views Asked by At

Problem: I want to index my field collection items, so that they are searchable by the user.

My Content Types are based of several Field-Collections, which are containing many text fields that should be searchable.

The fields belonging to the Field Collection (e.q. subtitle, text, etc.) are missing and NOT indexed. What can I do to add them to the search index?

1

There are 1 answers

0
Shad Amez On

Add a the field "collection" in the schema.xml as below.

<field name="collection" type="text_general" indexed="true" stored="false" multiValued="true"/>

Its not stored as the other fields that come under collection field (Eg. text, subtitle ) will be copied to this field.

Therefore define the field text, subtitle and then copy them using copyField to the collection field as below.

<field name="text" type="text_general" indexed="true" stored="true" />
<field name="subtitle" type="text_general" indexed="true" stored="true" />

Now copy the above two fields to the collection field as below.

<copyField source="text" dest="collection"/>
<copyField source="subtitle" dest="collection"/>