• Development

    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.

  • Development

    Sorting by Specific Fields with Apache Solr

    Recently I had to configure an Apache Solr search page to have the results sorted by a date field. We’re using the apachesolr module, which has a number of useful hooks, two of which we’ll use to accomplish this custom sort.

    If you browse to Administration » Reports » Apache Solr search index you will see a list of the indexed fields (example shown below). Most of the documentation I’ve seen out there regarding apachesolr sorting says you can use $query->setAvailableSort()  and $query->setSolrSort() within an implementation of  hook_apachesolr_query_prepare() , but there is at least one caveat: the field you want to sort on must be a single-value field! Here’s a look at the field list on the site I’m working on: