Case
search_api_node_access_records_alter calls datasource()->getItemId on received node. This function (getItemId) is allowed to return NULL as item id. Returned value is pushed into an array called $item_ids. Just after that search_api_track_item_change_for_indexes is called, and inside SearchApiDataSourceControllerInterface::trackItemChange si called.
SearchApiDataSourceControllerInterface::trackItemChange signature is:
trackItemChange($item_ids, array $indexes, $dequeue = FALSE);
With $items_ids documented as: array|false Either an array with the IDs of the changed items. Or FALSE to mark all items as changed for the given indexes.
But trackItemChange is receiving as $item_ids an array with a NULL element:
array(
0 => NULL
);
Proposed resolution
To avoid this search_api_node_access_records_alter should not push NULL values into $item_ids array.
Additional info
This issue comes from debugging this one: #2738911: SearchApiEtDatasourceController::getItemId that returns NULL could force loading all nodes
| Comment | File | Size | Author |
|---|---|---|---|
| edit-2738911-1.patch | 663 bytes | tunic |
Comments
Comment #3
drunken monkeyThanks a lot, looks good!
Committed.
The real problem, of course, is that allowing
NULLasgetItemId()return value is a design flaw. But nothing we can do about that really, so this is probably the best we can do.