diff --git a/apachesolr.index.inc b/apachesolr.index.inc
index b7479cf..3ca39ba 100644
--- a/apachesolr.index.inc
+++ b/apachesolr.index.inc
@@ -900,7 +900,7 @@ function apachesolr_index_node_status_callback($entity_id, $entity_type) {
 /**
  * Callback that converts term_reference field into an array
  */
-function apachesolr_term_reference_indexing_callback($node, $field_name, $index_key, $field_info) {
+function apachesolr_term_reference_indexing_callback($node, $field_name, $index_key, $field_info, $entity_type) {
   // Keep ancestors cached
   $ancestors = &drupal_static(__FUNCTION__, array());
 
@@ -981,7 +981,7 @@ function apachesolr_vocab_name($vid) {
  * For every multivalued value we also add a single value to be able to
  * use the stats
  */
-function apachesolr_fields_default_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_fields_default_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   $numeric = TRUE;
   if (!empty($entity->{$field_name})) {
@@ -1032,7 +1032,7 @@ function apachesolr_fields_default_indexing_callback($entity, $field_name, $inde
  * This function is used during indexing to normalize the DATE and DATETIME
  * fields into the appropriate format for Apache Solr.
  */
-function apachesolr_date_default_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_date_default_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   if (!empty($entity->{$field_name})) {
     $field = $entity->$field_name;
@@ -1071,7 +1071,7 @@ function apachesolr_date_default_indexing_callback($entity, $field_name, $index_
  * This function is used during indexing to normalize the DATESTAMP fields
  * into the appropriate format for Apache Solr.
  */
-function apachesolr_datestamp_default_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_datestamp_default_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   if (!empty($entity->{$field_name})) {
     // $fields may end up having two values; one for the start date
@@ -1109,7 +1109,7 @@ function apachesolr_floatval($value) {
  *  Indexing callback for the node_reference module
  *  by the references module
  */
-function apachesolr_nodereference_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_nodereference_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   if (!empty($entity->{$field_name})) {
     $index_key = apachesolr_index_key($field_info);
@@ -1131,7 +1131,7 @@ function apachesolr_nodereference_indexing_callback($entity, $field_name, $index
  *  Indexing callback for the user_reference module
  *  by the references module
  */
-function apachesolr_userreference_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_userreference_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   if (!empty($entity->$field_name)) {
     $index_key = apachesolr_index_key($field_info);
@@ -1152,13 +1152,13 @@ function apachesolr_userreference_indexing_callback($entity, $field_name, $index
 /**
  * Indexing callback for entityreference fields.
  */
-function apachesolr_entityreference_indexing_callback($entity, $field_name, $index_key, $field_info) {
+function apachesolr_entityreference_indexing_callback($entity, $field_name, $index_key, $field_info, $entity_type) {
   $fields = array();
   if (!empty($entity->{$field_name})) {
 
     // Gets entity type and index key. We need to prefix the ID with the entity
     // type so we know what entity we are dealing with in the mapping callback.
-    $entity_type = $field_info['field']['settings']['target_type'];
+    $target_entity_type = $field_info['field']['settings']['target_type'];
     $index_key = apachesolr_index_key($field_info);
 
     // Iterates over all references and adds them to the fields.
@@ -1167,7 +1167,7 @@ function apachesolr_entityreference_indexing_callback($entity, $field_name, $ind
         if ($id = (!empty($reference['target_id'])) ? $reference['target_id'] : FALSE) {
           $fields[] = array(
             'key' => $index_key,
-            'value' => $entity_type . ':' . $id,
+            'value' => $target_entity_type . ':' . $id,
           );
         }
       }
diff --git a/apachesolr.module b/apachesolr.module
index df104d7..59a7dbc 100644
--- a/apachesolr.module
+++ b/apachesolr.module
@@ -2031,7 +2031,7 @@ function field_apachesolr_index_document_build(ApacheSolrDocument $document, $en
           if ($function && function_exists($function)) {
             // NOTE: This function should always return an array.  One
             // entity field may be indexed to multiple Solr fields.
-            $fields = $function($entity, $field_name, $index_key, $field_info);
+            $fields = $function($entity, $field_name, $index_key, $field_info, $entity_type);
             foreach ($fields as $field) {
               // It's fine to use this method also for single value fields.
               $document->setMultiValue($field['key'], $field['value']);
