Browse Source

Merge pull request #563 from vesameskanen/relax-name-deduping

Do not consider absence of an additional name as a difference
pull/571/head
Julian Simioni 9 years ago committed by GitHub
parent
commit
cad9d13be9
  1. 5
      middleware/dedupe.js
  2. 28
      test/unit/fixture/dedupe_elasticsearch_results.js

5
middleware/dedupe.js

@ -51,7 +51,10 @@ function isDifferent(item1, item2) {
if (item1.hasOwnProperty('name') && item2.hasOwnProperty('name')) {
for (var lang in item1.name) {
propMatch(item1.name, item2.name, lang);
if(item2.name[lang] || lang === 'default') {
// do not consider absence of an additional name as a difference
propMatch(item1.name, item2.name, lang);
}
}
}
else {

28
test/unit/fixture/dedupe_elasticsearch_results.js

@ -80,6 +80,34 @@ module.exports = [
'_score': 1.2367082,
'confidence': 0.879
},
{ // same as #1, but with an additional name
'center_point': {
'lon': -76.207456,
'lat': 40.039265
},
'address_parts': {},
'parent': {
'localadmin': ['East Lampeter'],
'region_a': ['PA'],
'region': ['Pennsylvania'],
'locality': ['Smoketown'],
'country_a': ['USA'],
'county': ['Lancaster County'],
'country': ['United States'],
'neighbourhood': ['Greenland']
},
'name': {
'default': 'East Lampeter High School',
'alt': 'High School of East Lampeter',
},
'category': [
'education'
],
'_id': '357321757',
'_type': 'venue',
'_score': 1.2367082,
'confidence': 0.879
},
{
'center_point': {
'lon': -76.207456,

Loading…
Cancel
Save