function apachesolr_nodereference_indexing_callback in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr.index.inc \apachesolr_nodereference_indexing_callback()
- 7 apachesolr.index.inc \apachesolr_nodereference_indexing_callback()
Indexing callback for the node_reference module by the references module
Parameters
object $entity:
string $field_name:
string $index_key:
array $field_info:
Return value
array $fields
1 string reference to 'apachesolr_nodereference_indexing_callback'
- node_reference_apachesolr_field_mappings in ./
apachesolr.module - Implements hook_apachesolr_field_mappings() on behalf of References (node_reference).
File
- ./
apachesolr.index.inc, line 1241 - Functions related to Apache Solr indexing operations.
Code
function apachesolr_nodereference_indexing_callback($entity, $field_name, $index_key, array $field_info) {
$fields = array();
// Druapl 7 core sets all fields to use LANGUAGE_NONE even if the entity
// (e.g. node) is flagged as being in a specific language.
if (!empty($entity->{$field_name}) && isset($entity->{$field_name}[LANGUAGE_NONE])) {
$index_key = apachesolr_index_key($field_info);
foreach ($entity->{$field_name}[LANGUAGE_NONE] as $reference) {
if ($index_value = !empty($reference['nid']) ? $reference['nid'] : FALSE) {
$fields[] = array(
'key' => $index_key,
'value' => $index_value,
);
}
}
}
return $fields;
}