When indexing content, I had hundreds of the following error message:
Notice: Undefined property: stdClass::$nid in DatabaseStatementBase->fetchAllAssoc() (line 2166 of [docroot]/includes/database/database.inc).

From debugging, the source of the error appears to be lines 1087-1092 of apachesolr.index.inc, in the function apachesolr_index_node_check_table():

  // Check for deleted content that wasn't deleted from the index.
  $query = db_select($table, 'aien')
    ->fields('aien', array('entity_id'))
    ->isNull('n.nid')
    ->range(0, ($limit*2));
  $query->leftJoin('node', 'n', 'n.nid = aien.entity_id');
  $nodes = $query->execute()->fetchAllAssoc('nid');

In that last line, I think the error is happening because nid is null (per the query). Should the line instead read as follows?

  $nodes = $query->execute()->fetchAllAssoc('entity_id');

Comments

nick_vh’s picture

Version: 7.x-1.0-beta19 » 6.x-3.x-dev
Status: Active » Patch (to be ported)

Well caught error, committed to latest dev

nick_vh’s picture

Status: Patch (to be ported) » Fixed

Does not apply to 6.x-3.x

nick_vh’s picture

Status: Fixed » Closed (fixed)