Adding Metatag Keywords to Search API Index

For a great explanation of the implementation below, please visit http://enzolutions.com/articles/2015/06/02/how-to-add-customs-fields-to-solr-index-using-entity-api-amp-search-api/

The following demonstrates how to add metatag keywords (from the Metatag module) to your Search API fields list, so that you can index them and make them searchable.

  1. Add code below
  2. Clear all caches (drush cc all)
  3. Browse to /admin/config/search/search_api
  4. Click the Edit operation for the appropriate index
  5. Browse to the Fields tab
  6. Click the checkbox beside Keywords field from metatag module
  7. Adjust Boost value as needed
  8. Click Save changes
To include this field in your Views-based search results fulltext search filter:
  1. Edit your search View
  2. Update your fulltext search exposed filter
  3. Make sure the new field is selected in the Searched fields select list (it will be included if none of the items are selected)
 

Tagged with: , , , ,
Posted in Development
2 comments on “Adding Metatag Keywords to Search API Index
  1. Neil says:

    Hello,

    I’ve used the code that you’ve provided but am not able to see “Keywords field from metatag” in the search API options.

    What I’ve done is place your code in my template.php file & replaced “mymodule” with the machine name of my theme. Is that correct?

    Thanks for any help,
    Neil.

    • Neil says:

      I just realised my mistake, it needed to be in a custom module instead which I’ve done and the checkbox now shows up. Although it unfortunately doesn’t seem to index the field :(.

Leave a Reply

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

*