Skip ambiguous matches (like Target~(USA) vs Target~(Australia))

This also reorders the nsiKeys array to maybe match slightly quicker
This commit is contained in:
Bryan Housel
2019-05-17 09:45:08 -04:00
parent 94c5164fe2
commit 7a07506edc
+4 -1
View File
@@ -15,7 +15,7 @@ export function validationOutdatedTags() {
// initialize name-suggestion-index matcher
var nsiMatcher = matcher();
nsiMatcher.buildMatchIndex(brands.brands);
var nsiKeys = ['amenity', 'leisure', 'shop', 'tourism'];
var nsiKeys = ['amenity', 'shop', 'tourism', 'leisure'];
function oldTagIssues(entity, context) {
@@ -64,6 +64,9 @@ export function validationOutdatedTags() {
var match = nsiMatcher.matchKVN(k, newTags[k], newTags.name);
if (!match) continue;
// for now skip ambiguous matches (like Target~(USA) vs Target~(Australia))
if (match.d) continue;
var brand = brands.brands[match.kvnd];
if (brand) {
Object.assign(newTags, brand.tags);