From d52c6077a96ab1da74b8261d0f3d8c70f3811f42 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Thu, 25 Sep 2014 18:46:00 +0100 Subject: [PATCH] add 'text' property to /search and /reverse --- helper/geojsonify.js | 5 +++++ test/unit/helper/geojsonify.js | 2 ++ 2 files changed, 7 insertions(+) diff --git a/helper/geojsonify.js b/helper/geojsonify.js index 2dd81ea2..bd78b1f0 100644 --- a/helper/geojsonify.js +++ b/helper/geojsonify.js @@ -73,6 +73,11 @@ function search( docs ){ if( doc.admin1 ){ output.admin1 = doc.admin1; } if( doc.admin2 ){ output.admin2 = doc.admin2; } + // map suggest output + if( doc.suggest && doc.suggest.output ){ + output.text = doc.suggest.output; + } + return output; // filter-out invalid entries diff --git a/test/unit/helper/geojsonify.js b/test/unit/helper/geojsonify.js index 3e802837..e74e4b4d 100644 --- a/test/unit/helper/geojsonify.js +++ b/test/unit/helper/geojsonify.js @@ -140,6 +140,7 @@ module.exports.tests.search = function(test, common) { ] }, "properties": { + "text": "'Round Midnight Jazz and Blues Bar, Angel, United Kingdom", "name": "'Round Midnight Jazz and Blues Bar", "admin0": "United Kingdom", "admin1": "Islington", @@ -156,6 +157,7 @@ module.exports.tests.search = function(test, common) { ] }, "properties": { + "text": "Blues Cafe, Smithfield, United Kingdom", "name": "Blues Cafe", "admin0": "United Kingdom", "admin1": "City And County Of The City Of London",