You are here

function hook_search_api_attachments_indexable in Search API attachments 9.0.x

Same name and namespace in other branches
  1. 8 search_api_attachments.api.php \hook_search_api_attachments_indexable()
  2. 7 search_api_attachments.api.php \hook_search_api_attachments_indexable()

Determines whether an attachment should be indexed.

Parameters

object $file: A file object.

\Drupal\search_api\Item\ItemInterface $item: The item the file was referenced in.

string $field_name: The name of the field the file was referenced in.

Return value

bool|null Return FALSE if the attachment should not be indexed.

2 invocations of hook_search_api_attachments_indexable()
ExtractedText::isFileIndexable in src/Plugin/Field/FieldFormatter/ExtractedText.php
Check if the file is allowed to be indexed.
FilesExtractor::isFileIndexable in src/Plugin/search_api/processor/FilesExtractor.php
Check if the file is allowed to be indexed.

File

./search_api_attachments.api.php, line 26
Hooks provided by the "Search API attachments" module.

Code

function hook_search_api_attachments_indexable($file, \Drupal\search_api\Item\ItemInterface $item, $field_name) {

  // Don't index files on entities owned by our bulk upload bot accounts.
  if (in_array($item
    ->getOriginalObject()->uid, my_module_blocked_uids())) {
    return FALSE;
  }
}