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

improved deduping across languages #1228

Closed
wants to merge 2 commits into from
Closed

improved deduping across languages #1228

wants to merge 2 commits into from

Conversation

missinglink
Copy link
Member

@missinglink missinglink commented Oct 31, 2018

following on from #1222 this PR changes two behaviours:

  • improved matching across languages
  • matching on aliases

improved matching across languages

The previous code would cycle through all the names in item1 and first do a key-check on item2, only if the key also existed in the second item, it would then compare values, if they differed then the two items were considered different.

The issue with that approach is something like this, which is considered different:

var item1 = {
  'name': {
    'default': 'Bern',
    'eng': 'Bern'
  }
};
var item2 = {
  'name': {
    'default': 'Bern',
    'eng': 'Berne'
  }
};

The new code does it differently, instead it first cycles through all the values in item2, comparing them to item1.default, then it cycles through all the values in item1 and compares them to item2.default.

So it's essentially saying "If any of the language values matched the default value of the other item, consider them as a dupe"

[edit] I added another commit which now also considers the user agent language for comparison on top of the default.

matching on aliases

We were only matching on the first item in an array of values, this code uses slightly more CPU but it considers all aliases in deduplication.

@missinglink missinglink changed the title improved matching across languages improved deduping across languages Oct 31, 2018
@missinglink missinglink force-pushed the dedupe branch 2 times, most recently from 0ef58ab to 6b28707 Compare October 31, 2018 11:25
@missinglink missinglink mentioned this pull request Nov 1, 2018
@orangejulius
Copy link
Member

orangejulius commented Nov 5, 2018

I tested this one on dev, and it doesn't break any acceptance tests, but I also couldn't find any improvements. I'm guessing this requires some of the other deduping PRs as well.

If you can think of a case that should be improved by using just this PR, let me know

@missinglink
Copy link
Member Author

included in #1230

@missinglink missinglink closed this Nov 5, 2018
@orangejulius orangejulius deleted the dedupe branch January 22, 2019 03:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants