- Issue created by @joachim
search_api_node_access_records_alter() makes several assumptions about how an index is handling entities and search item Ids:
foreach ($index->getDatasources() as $datasource_id => $datasource) {
switch ($datasource->getEntityTypeId()) {
case 'node':
SNIP
$item_id = $datasource->getItemId($node->getTypedData());
Here it's assuming that any data source that handles nodes is forming search items from the node's typed data representation.
$item_id = $datasource->getItemId($node->getTypedData());
if ($item_id !== NULL) {
$index->trackItemsUpdated($datasource_id, [$item_id]);
}
Here it's assuming that there will be only one index ID for a particular node.
However, neither of these two assumptions are always correct!
I'm in the process of writing a SearchAPI datasource for entities with https://www.drupal.org/project/date_recur → . It's very similar to this sandbox https://www.drupal.org/sandbox/sam/3200275 → but instead of passing custom typed data into the index, I'm passing multiple versions of the same entity, one for each occurrence of the recurring date, with different date value each time.
Active
1.0
General code