function apachesolr_userreference_indexing_callback in Apache Solr Search 8
Same name and namespace in other branches
- 6.3 apachesolr.index.inc \apachesolr_userreference_indexing_callback()
- 7 apachesolr.index.inc \apachesolr_userreference_indexing_callback()
Indexing callback for the user_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_userreference_indexing_callback'
- user_reference_apachesolr_field_mappings in ./
apachesolr.module - Implements hook_apachesolr_field_mappings() on behalf of References (user_reference).
File
- ./
apachesolr.index.inc, line 1269 - Functions related to Apache Solr indexing operations.
Code
function apachesolr_userreference_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 = isset($reference['uid']) && strlen($reference['uid']) ? $reference['uid'] : FALSE) {
$fields[] = array(
'key' => $index_key,
'value' => $index_value,
);
}
}
}
return $fields;
}