From da72a968f9e619e0604ab5be33271fb1d8c3ea5f Mon Sep 17 00:00:00 2001 From: Stephen Hess Date: Wed, 23 Nov 2016 00:12:57 -0500 Subject: [PATCH] switch importance of address/street --- middleware/trimByGranularityComponent.js | 4 ++-- .../middleware/trimByGranularityComponent.js | 24 +++++++++---------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/middleware/trimByGranularityComponent.js b/middleware/trimByGranularityComponent.js index afef01f0..1fe94ce8 100644 --- a/middleware/trimByGranularityComponent.js +++ b/middleware/trimByGranularityComponent.js @@ -22,8 +22,8 @@ const _ = require('lodash'); // supplied we want to retain borough=Manhattan and city=Manhattan results const layers = [ 'venue', - 'street', 'address', + 'street', 'neighbourhood', ['borough', 'locality'], 'localadmin', @@ -44,8 +44,8 @@ const layers = [ // city=Manhattan const explicit_borough_layers = [ 'venue', - 'street', 'address', + 'street', 'neighbourhood', 'borough', 'locality', diff --git a/test/unit/middleware/trimByGranularityComponent.js b/test/unit/middleware/trimByGranularityComponent.js index 69c80e92..d90a3803 100644 --- a/test/unit/middleware/trimByGranularityComponent.js +++ b/test/unit/middleware/trimByGranularityComponent.js @@ -19,8 +19,8 @@ module.exports.tests.trimByGranularity = function(test, common) { data: [ { name: 'venue 1', _matched_queries: ['fallback.venue'] }, { name: 'venue 2', _matched_queries: ['fallback.venue'] }, - { name: 'street 1', _matched_queries: ['fallback.street'] }, { name: 'address 1', _matched_queries: ['fallback.address'] }, + { name: 'street 1', _matched_queries: ['fallback.street'] }, { name: 'neighbourhood 1', _matched_queries: ['fallback.neighbourhood'] }, { name: 'borough 1', _matched_queries: ['fallback.borough'] }, { name: 'locality 1', _matched_queries: ['fallback.locality'] }, @@ -55,9 +55,9 @@ module.exports.tests.trimByGranularity = function(test, common) { var res = { data: [ - { name: 'street 1', _matched_queries: ['fallback.street'] }, - { name: 'street 2', _matched_queries: ['fallback.street'] }, { name: 'address 1', _matched_queries: ['fallback.address'] }, + { name: 'address 2', _matched_queries: ['fallback.address'] }, + { name: 'street 1', _matched_queries: ['fallback.street'] }, { name: 'neighbourhood 1', _matched_queries: ['fallback.neighbourhood'] }, { name: 'borough 1', _matched_queries: ['fallback.borough'] }, { name: 'locality 1', _matched_queries: ['fallback.locality'] }, @@ -73,13 +73,13 @@ module.exports.tests.trimByGranularity = function(test, common) { }; var expected_data = [ - { name: 'street 1', _matched_queries: ['fallback.street'] }, - { name: 'street 2', _matched_queries: ['fallback.street'] } + { name: 'address 1', _matched_queries: ['fallback.address'] }, + { name: 'address 2', _matched_queries: ['fallback.address'] } ]; function testIt() { trimByGranularity(req, res, function() { - t.deepEquals(res.data, expected_data, 'only street records should be here'); + t.deepEquals(res.data, expected_data, 'only address records should be here'); t.end(); }); } @@ -87,13 +87,13 @@ module.exports.tests.trimByGranularity = function(test, common) { testIt(); }); - test('all records with fallback.* matched_queries name should retain only address when they are most granular', function(t) { + test('all records with fallback.* matched_queries name should retain only street when they are most granular', function(t) { var req = { clean: {} }; var res = { data: [ - { name: 'address 1', _matched_queries: ['fallback.address'] }, - { name: 'address 2', _matched_queries: ['fallback.address'] }, + { name: 'street 1', _matched_queries: ['fallback.street'] }, + { name: 'street 2', _matched_queries: ['fallback.street'] }, { name: 'neighbourhood 1', _matched_queries: ['fallback.neighbourhood'] }, { name: 'borough 1', _matched_queries: ['fallback.borough'] }, { name: 'locality 1', _matched_queries: ['fallback.locality'] }, @@ -109,13 +109,13 @@ module.exports.tests.trimByGranularity = function(test, common) { }; var expected_data = [ - { name: 'address 1', _matched_queries: ['fallback.address'] }, - { name: 'address 2', _matched_queries: ['fallback.address'] }, + { name: 'street 1', _matched_queries: ['fallback.street'] }, + { name: 'street 2', _matched_queries: ['fallback.street'] }, ]; function testIt() { trimByGranularity(req, res, function() { - t.deepEquals(res.data, expected_data, 'only address records should be here'); + t.deepEquals(res.data, expected_data, 'only street records should be here'); t.end(); }); }