From 9907b58f098613a4ad90a6087739a6af554b4e80 Mon Sep 17 00:00:00 2001 From: Julian Simioni Date: Thu, 4 Feb 2021 08:27:48 -0800 Subject: [PATCH] fix(libpostal): special case 'union square' parse While also a neighbourhood, most data for places called 'Union Square' are actually in the `venue` layer, so it's generally better to allow this query to hit Elasticsearch and return venues. --- controller/libpostal.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/controller/libpostal.js b/controller/libpostal.js index 37e2f19a4..c2f7cf360 100644 --- a/controller/libpostal.js +++ b/controller/libpostal.js @@ -202,6 +202,14 @@ function patchBuggyResponses(response){ } } + // union square should be venue, not neighbourhood + let suburb = _.get(idx, 'suburb'); + // change suburb to house (turned into 'query' by pelias) + if (suburb && suburb.label === 'suburb' && suburb.value === 'union square') { + _.pullAt(response, suburb._pos); + response.push({ label: 'house', value: suburb.value }); + } + return response; }