function _file_entity_index_file in File Entity (fieldable files) 7.2
Same name and namespace in other branches
- 7.3 file_entity.module \_file_entity_index_file()
Index a single file.
Parameters
$file: The file to index.
1 call to _file_entity_index_file()
- file_entity_update_index in ./
file_entity.module - Implements hook_update_index().
File
- ./
file_entity.module, line 719 - Extends Drupal file entities to be fieldable and viewable.
Code
function _file_entity_index_file($file) {
$file = file_load($file->fid);
// Save the creation time of the most recent indexed file, for the search
// results half-life calculation.
variable_set('file_entity_cron_last', $file->timestamp);
// Render the file.
$build = file_view($file, 'search_index');
unset($build['#theme']);
$file->rendered = drupal_render($build);
$text = '<h1>' . check_plain($file->filename) . '</h1>' . $file->rendered;
// Fetch extra data normally not visible
$extra = module_invoke_all('file_entity_update_index', $file);
foreach ($extra as $t) {
$text .= $t;
}
// Update index
search_index($file->fid, 'file', $text);
}