Recoverable fatal error: Argument 2 passed to SearchApiViewsQuery::extractFields() must be an array, none given, called in E:\xampp\htdocs\drupal-7.0\sites\all\modules\search_api\contrib\search_api_views\includes\query.inc on line 159 and defined in SearchApiViewsQuery->extractFields() (line 192 of E:\xampp\htdocs\drupal-7.0\sites\all\modules\search_api\contrib\search_api_views\includes\query.inc).

Missing 2nd arg for extractFields() should be $this->fields, I think (works for me).

  protected function addResults(array $results, $view) {
    // Maybe the service class or a postprocessor already set the entities.
    foreach ($results as $id => $result) {
      if (!empty($result['entity']) && ($fields = $this->extractFields($result['entity']))) {
  protected function extractFields(EntityMetadataWrapper $wrapper, array $all_fields) {

Comments

drunken monkey’s picture

Status: Active » Needs review
StatusFileSize
new1.11 KB

Oh, thanks for spotting this! This call is indeed rather broken … Not only is the second parameter missing, but the first one should be an entity wrapper, not just an entity. Is it really working for you after just adding the second parameter? That shouldn't be the case, unless you hand it a wrapper under the "entity" key (which you shouldn't).

Please see if the attached patch works for you.

zenlan’s picture

It was a bit confusing and I did groan when I first sent an entity only to find that it expected a wrapper! ;)

After patching there were no errors when tested using a search_api_solr/node entity index.

Also no errors when tested with my custom solr service class/custom entity index - after I replaced $result['entity'] with an actual entity instead of a wrapper.

Thanks for the prompt patch!

drunken monkey’s picture

Title: Recoverable fatal error: Missing argument for extractFields() » Missing argument for extractFields()
Status: Needs review » Fixed

Good to hear. Patch committed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.