It would be nice if the hash plugin provided an option to create the hash over only the sources being used in the importer.

I have a feed that has many often-changing sources, but I'm only interested in importing and tracking changes to only a select few.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

twistor’s picture

Assigned: Unassigned » twistor

I like it!

twistor’s picture

I'm thinking that we should have two separate plugins for backwards compatibility. I can mark the old one deprecated in the UI. But leave it for a while. hmm...

jeffschuler’s picture

Thanks for your support of this.
Why not provide both options? There are potential use cases for both.

twistor’s picture

I don't really want two plugins that do almost the same thing. At the same time, I don't want to have a check for the old configuration on every run either. Although I was making it more complicated than it had to be. I'll just add an upgrade routine the moves existing configurations over to the new one.

jeffschuler’s picture

Sounds good. This way of doing it is more sensible anyway, and can accommodate the other use case.

queenvictoria’s picture

I've created a patch to add the import fields as checkboxes and default to `all fields` if no fields are checked. It needs a bit of testing but its a start.
The reason I've implemented this differently is I want to import all the fields but only test uniqueness on some of them (as some source fields change when they shouldn't).

queenvictoria’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, feeds_tamper-hash_only_chosen_fields-1297650-6.patch, failed testing.

queenvictoria’s picture

Issue summary: View changes

Looks like this might have been included somewhere along the line as it is in 7.x-1.1. This issue should be closed I think. Twistor?
Sorry I was looking at my patched version not 7.x-1.1

Blanca.Esqueda’s picture

Status: Needs work » Needs review
FileSize
1.7 KB

Hello,

Similar situation, I needed the hash being created base on some fields and not all the fields for that feed item, to be able to update changes instead of have new records when the feed import runs again.

Please find attached the patch. It has backwards compatibility so feeds that already use the hash tamper plugin won't be affected with this patch.
The patch allows the options to overwrite set values and hash all the fields of the feed item (as previously), plus the option of hash only the current value.

The option to hash only the current value combined to other tamper plugins offers a lot of flexibility.
As a sample to create the composed unique field: I used the rewrite plugin to concatenate the fields I needed and then used the hash current value option to generate the number to be assigned as GUID. But imagination is the limit, hash and other tamper plugins can be used to address other scenarios.

Status: Needs review » Needs work

The last submitted patch, 10: hash_over_only_the-1297650-10.patch, failed testing.

Blanca.Esqueda’s picture

There you go again... removed message outputs.

Blanca.Esqueda’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 12: hash_over_only_the-1297650-11.patch, failed testing.

Blanca.Esqueda’s picture

Blanca.Esqueda’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 15: hash_over_only_the-1297650-15.patch, failed testing.

Blanca.Esqueda’s picture

Status: Needs work » Needs review

Updated the ticket to needs review, because the patch it is working tried simplytest.me beside local testing.
The patch passed the hash test case but It seems like the other feed test cases have not been updated.

MegaChriz’s picture

Closed #1444628: Add option to hash plugin to hash multiple fields. as a duplicate.

Quick glancing over the patches, to me it looks like the patch in #6 would be the most useful.