How to properly alter response from Solr Search Module I'm working on Drupal Version 7.22 and I'm trying to modify the results coming from Solr using the hook provided by the Solr Search Module.

The specific hook can be found here: http://drupalcontrib.org/api/drupal/contributions!search_api_solr!search_api_solr.api.php/function/hook_search_api_solr_search_results_alter/7

Here's how I implemented it from the module:

/**
 * Implements hook_search_api_solr_search_results_alter().
 */
function zen_search_api_solr_search_results_alter(array &amp;$results, SearchApiQueryInterface $query, Apache_Solr_Response $response){


  $locations = array();  

  $rest = $results['results'];
  foreach($rest as $r){

    $place = $r['fields']['field_business_name'];
    $postal_code =  urlencode($r['fields']['field_business_address:postal_code']);

    $api = 'http://maps.googleapis.com/maps/api/geocode/json?address=' .  $postal_code . '&amp;sensor=false';
    $api_results = file_get_contents($api);
        $data = json_decode($api_results, true);

        if($data['status'] == 'OK'){
            $location = $data['results'][0]['geometry']['location'];

            $locations[] = array(
                'place' =&gt; $place,
                'lat' =&gt; $location['lat'],
                'lng' =&gt; $location['lng']
            );      
        }

  }

    $data = array('zen' =&gt; array('locations' =&gt; $locations));
    drupal_add_js($data, 'setting');

}


So basically what I'm trying to do here is to add the coordinates that I get from the Google  maps Geo-coding API using drupal_add_js.

But I'm getting the following error:


  Recoverable fatal error: Argument 3 passed to
  zen_search_api_solr_search_results_alter() must be an
  instance of Apache_Solr_Response, instance of stdClass given


Any ideas what's wrong here?
The problem was this one:

function zen_search_api_solr_search_results_alter(array &amp;$results, SearchApiQueryInterface $query, Apache_Solr_Response $response){
  ...
}


It should be this:

function zen_search_api_solr_search_results_alter(&amp;$results, $query, $response){
  ...
}