You are here

function apachesolr_attachments_apachesolr_query_alter in Apache Solr Attachments 6.3

Same name and namespace in other branches
  1. 7 apachesolr_attachments.module \apachesolr_attachments_apachesolr_query_alter()

Implements hook_apachesolr_query_alter().

File

./apachesolr_attachments.module, line 417
Provides a file attachment search implementation for use with the Apache Solr module

Code

function apachesolr_attachments_apachesolr_query_alter(DrupalSolrQueryInterface $query) {
  if ($query
    ->getName() == 'apachesolr') {

    // Fetch the extra file data on searches.
    $query
      ->addParam('fl', array(
      'zm_parent_entity',
      'ss_filemime',
      'ss_file_entity_title',
      'ss_file_entity_url',
    ));
  }
  elseif ($query
    ->getName() == 'apachesolr_mlt') {

    // Exclude files from MLT results.
    $query
      ->addFilter('entity_type', 'file', TRUE);
  }
}