function _apachesolr_attachments_get_all_files in Apache Solr Attachments 7
Same name and namespace in other branches
- 6.3 apachesolr_attachments.module \_apachesolr_attachments_get_all_files()
Fetches all files linked to nodes created by fields from the file module regardless of the widget
Return value
type
1 call to _apachesolr_attachments_get_all_files()
- apachesolr_attachments_solr_reindex in ./
apachesolr_attachments.module - Reindexing callback for ApacheSolr, for file entities.
File
- ./
apachesolr_attachments.module, line 308 - Provides a file attachment search implementation for use with the Apache Solr module
Code
function _apachesolr_attachments_get_all_files() {
$results = array();
$fields = field_info_field_by_ids();
foreach ($fields as $field_id => $field_info) {
if ($field_info['type'] == 'file') {
foreach ($field_info['bundles'] as $entity_type => $bundles) {
$entity_info = entity_get_info($entity_type);
// If this entity type is not indexable, ignore this and move on to the
// next one
if (empty($entity_info['apachesolr']['indexable'])) {
continue;
}
$query = new ApachesolrAttachmentsEntityFieldQuery();
$results_query = $query
->entityCondition('entity_type', $entity_type)
->fieldCondition($field_info['field_name'])
->addExtraField($field_info['field_name'], 'fid', 'fid')
->execute();
$results = array_merge_recursive($results, $results_query);
}
}
}
return $results;
}