I have a feeds importer defined and I can use it as a standalone or attach it to content type. If I attach feed importer to a content type (for example, custom_import content type) I get duplicates when I import the same data in two nodes of content type custom_import, while in D7 data would be recognized as duplicate.
This is caused by the following line in modules/feeds/plugins/FeedsProcessor.inc
The check happens in the existingEntityId() method at lines 1282-1290:
if ($target === 'guid' || $target === 'url') { $entity_id = db_select('feeds_item') ->fields('feeds_item', array('entity_id')) ->condition('feed_nid', $source->feed_nid) // ← This uses lookup_guid ->condition('entity_type', $this->entityType()) ->condition('id', $source->id) ->condition($target, $value) ->execute() ->fetchField(); }
There are two database indexes:
lookup_guid: includes feed_nid — ('entity_type', 'id', 'feed_nid', array('guid', 128))
global_lookup_guid: does not include feed_nid — ('entity_type', array('guid', 128))
The current code uses the lookup that includes feed_nid. The fix (removing feed_nid from the GUID lookup) aligns with the global_lookup_guid index and should prevent duplicates.
However, in Drupal 7 same code was not generating duplicates.
@indigoxela , @herbdool do you have any insights here?
I have a feeds importer defined and I can use it as a standalone or attach it to content type. If I attach feed importer to a content type (for example, custom_import content type) I get duplicates when I import the same data in two nodes of content type custom_import, while in D7 data would be recognized as duplicate.
This is caused by the following line in modules/feeds/plugins/FeedsProcessor.inc
The check happens in the existingEntityId() method at lines 1282-1290:
if ($target === 'guid' || $target === 'url') { $entity_id = db_select('feeds_item') ->fields('feeds_item', array('entity_id')) ->condition('feed_nid', $source->feed_nid) // ← This uses lookup_guid ->condition('entity_type', $this->entityType()) ->condition('id', $source->id) ->condition($target, $value) ->execute() ->fetchField(); }There are two database indexes:
lookup_guid: includes feed_nid — ('entity_type', 'id', 'feed_nid', array('guid', 128))
global_lookup_guid: does not include feed_nid — ('entity_type', array('guid', 128))
The current code uses the lookup that includes feed_nid. The fix (removing feed_nid from the GUID lookup) aligns with the
global_lookup_guidindex and should prevent duplicates.However, in Drupal 7 same code was not generating duplicates.
@indigoxela , @herbdool do you have any insights here?