You are here

function apachesolr_attachments_apachesolr_file_exclude in Apache Solr Attachments 6.3

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

Implenents hook_apachesolr_ENTITY_TYPE_exclude().

This is invoked for each file entity that is being inspected to be added to the index. if any module returns TRUE, the entity is skipped for indexing.

Parameters

integer $entity_id:

integer $row: A complete set of data from the indexing table.

string $env_id:

Return value

boolean

File

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

Code

function apachesolr_attachments_apachesolr_file_exclude($entity_id, $row, $env_id) {
  module_load_include('inc', 'apachesolr_attachments', 'apachesolr_attachments.index');

  // Make sure we have a boolean value.
  // Anything different from 1 becomes zero
  if (!$entity_id || !$row->parent_entity_id) {

    // Exclude
    return TRUE;
  }

  // Check if the parent entity is excluded
  $parent_entity_id = $row->parent_entity_id;
  $parent_entity_type = $row->parent_entity_type;
  $exclude = apachesolr_attachments_is_parent_excluded($entity_id, 'file', $parent_entity_id, $parent_entity_type, $env_id);
  if ($exclude) {

    // Exclude
    return TRUE;
  }

  // Do not exclude
  return FALSE;
}