Skip to content

Feed importer that is attached to a content type does not respect GUID from different nodes importing content #173

@irinaz

Description

@irinaz

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions