Combining Fields

Last updated on
24 March 2017

Drupal 7 will no longer be supported after January 5, 2025. Learn more and find resources for Drupal 7 sites

Purpose

Search API has each entity field as a separate field within the index. This is good in some cases, but when you need to be able to facet on -- say -- multiple fields that map to a single taxonomy it has limits. The Search API Combined module allows multiple fields to be combined into a single field which can then imitate an existing field for the purposes of faceting.

Getting Started

First download and install the Search API Combined module. You'll then go to Configuration -> Search API and select Workflow for the appropriate index. After you've enabled the Combined fields in Data Alterations you will see an option in Callback Settings for Combined fields. Select that and click on the button "Add new field" then give it a name and select one or more fields from the list below. You can also select a field for the new field to imitate if FacetAPI is enabled. Once you've created the combined field and clicked Save configuration you'll need to go to the index's Fields and enable the new field. After you've completed this you'll need to re-index. If you want to create a facet from the new field you may need to clear the cache before going to the index's Facets and enabling it there. One thing to note, if you want to have the new field Imitate an existing field the existing field must be indexed and selected as a Facet.

Limitations

At present the module has been tested for multiple term references and not with any other field type. It is currently set to index all combined fields as lists of items so it will not work with multiple fields that have single values that expect to stay as single values -- where this is important is in sorting, for instance, since you cannot sort by multiple values with Solr.

Help improve this page

Page status: No known problems

You can: