Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The search of existing elements doesn't work as expected in Feed Me 4.5.0 #1122

Closed
lcarcone opened this issue Apr 27, 2022 · 3 comments
Closed
Labels

Comments

@lcarcone
Copy link

Description

We have a multi-site implementation with a Primary site in English and other sites for translated content.
We first import the entries for the Primary site then we import the translated content using the slug as the unique identifier to match against existing elements.
When we import a translated content for an entry that exists in the Primary site (using the same slug), Feed Me doesn't find the existing element and creates a new one for the translation site (so the translated entry is not linked with the English entry).
Note that if we run the Feed for the translated entry a second time, if finds the second element that has been created and update it.
It seems that the search for existing elements is done on (slug, siteId) instead of (slug).

Steps to reproduce

  1. Import an entry for the Primary site -> Feed Me creates the corresponding element
  2. Import an entry for a translation site using the same slug as for the Primary site and set 'slug' as the unique identifier to match against existing elements -> Feed Me creates a new element instead of updating the first one.

Additional info

  • Craft version: 3.7.38
  • Feed Me version: 4.5.0
  • PHP version: 7.4.28
  • Database driver & version: MariaDB 10.3.34-MariaDB-0+deb10u1 Debian 10
@lcarcone lcarcone added the bug label Apr 27, 2022
@angrybrad
Copy link
Member

@lcarcone can you send a database dump, along with your composer.json/lock files, example feed(s), and point us to some steps to reproduce what you're seeing?

@lcarcone
Copy link
Author

lcarcone commented May 2, 2022

Hi,
feedme-logs-english
feedme-logs-chinese

I forgot to mention that we set up the propagation method to 'Let each entry choose which sites it should be saved to' for the corresponding section.

We defined two feeds, one to import English entries to the primary site and one to import the Chinese translations of these entries to the Chinese site.
Both feeds use CSV as Feed Type and set 'Slug' as the 'unique identifier to match against existing elements'.

We first import the English entries and Feed Me creates the corresponding elements (see one example in the feedme-logs-english sceenshot)
We then import the Chinese translations, each entry use the same slug as the corresponding English entry.
Feed Me doesn't find an existing element with the same slug and creates a new element (see feedme-logs-chinese sceenshot).
So we have two different elements that are not linked together while they have the same slug.

Note that after importing the English entries with Feed Me, if I add the Chinese site for an English entry through the UI, it works as expected and uses the same element created for the English entry.

Note also that the import of Chinese entries matched the English entries with the previous version of Feed Me 4.4.1.1

I have sent an email with pointers to a database dump, composer files and feed example files.

Regards

@angrybrad
Copy link
Member

Note also that the import of Chinese entries matched the English entries with the previous version of Feed Me 4.4.1.1

That behavior was incorrect, IMO, using the given settings. Reported in #1084 and fixed in f0962c6 (which was released in 4.5.0).

I'd say what's happening now is more aligned with expected behavior.

If you want to change it, you should be able to by writing a custom module/plugin that listened to the stepBeforeElemetnMatch event. That would check if the given slug exists in another site already and if so, changes the siteId to that existing slug's site.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants