function apachesolr_index_entities_document in Apache Solr Search 6.3
Same name and namespace in other branches
- 8 apachesolr.index.inc \apachesolr_index_entities_document()
- 7 apachesolr.index.inc \apachesolr_index_entities_document()
1 call to apachesolr_index_entities_document()
- apachesolr_index_entities in ./
apachesolr.index.inc - Processes all index queues associated with the passed environment.
File
- ./
apachesolr.index.inc, line 75 - Functions related to Apache Solr indexing operations.
Code
function apachesolr_index_entities_document($row, $entity_type, $env_id) {
$documents = array();
if (!empty($row->status)) {
// Let any module exclude this entity from the index.
$build_document = TRUE;
foreach (module_implements('apachesolr_exclude') as $module) {
$exclude = module_invoke($module, 'apachesolr_exclude', $row->entity_id, $entity_type, $row, $env_id);
// If the hook returns TRUE we should exclude the entity
if (!empty($exclude)) {
$build_document = FALSE;
}
}
foreach (module_implements('apachesolr_' . $entity_type . '_exclude') as $module) {
$exclude = module_invoke($module, 'apachesolr_' . $entity_type . '_exclude', $row->entity_id, $row, $env_id);
// If the hook returns TRUE we should exclude the entity
if (!empty($exclude)) {
$build_document = FALSE;
}
}
if ($build_document) {
// TODO argument #2 is not an array
$documents = array_merge($documents, apachesolr_index_entity_to_documents($row, $env_id));
}
}
else {
// Delete the entity from our index if the status callback returned 0
apachesolr_remove_entity($env_id, $row->entity_type, $row->entity_id);
}
return $documents;
}