|
|
@ -15,167 +15,167 @@ module.exports.tests.search = function(test, common) { |
|
|
|
|
|
|
|
|
|
|
|
var input = [ |
|
|
|
var input = [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
"_id": "id1", |
|
|
|
'_id': 'id1', |
|
|
|
"_type": "type1", |
|
|
|
'_type': 'type1', |
|
|
|
"center_point": { |
|
|
|
'center_point': { |
|
|
|
"lat": 51.5337144, |
|
|
|
'lat': 51.5337144, |
|
|
|
"lon": -0.1069716 |
|
|
|
'lon': -0.1069716 |
|
|
|
}, |
|
|
|
}, |
|
|
|
"name": { |
|
|
|
'name': { |
|
|
|
"default": "'Round Midnight Jazz and Blues Bar" |
|
|
|
'default': '\'Round Midnight Jazz and Blues Bar' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"type": "node", |
|
|
|
'type': 'node', |
|
|
|
"address": { |
|
|
|
'address': { |
|
|
|
"number": "13", |
|
|
|
'number': '13', |
|
|
|
"street": "Liverpool Road", |
|
|
|
'street': 'Liverpool Road', |
|
|
|
"zip": "N1 0RW" |
|
|
|
'zip': 'N1 0RW' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"alpha3": "GBR", |
|
|
|
'alpha3': 'GBR', |
|
|
|
"admin0": "United Kingdom", |
|
|
|
'admin0': 'United Kingdom', |
|
|
|
"admin1": "Islington", |
|
|
|
'admin1': 'Islington', |
|
|
|
"admin1_abbr": "ISL", |
|
|
|
'admin1_abbr': 'ISL', |
|
|
|
"admin2": "Angel", |
|
|
|
'admin2': 'Angel', |
|
|
|
"local_admin": "test1", |
|
|
|
'local_admin': 'test1', |
|
|
|
"locality": "test2", |
|
|
|
'locality': 'test2', |
|
|
|
"neighborhood": "test3", |
|
|
|
'neighborhood': 'test3', |
|
|
|
"suggest": { |
|
|
|
'suggest': { |
|
|
|
"input": [ |
|
|
|
'input': [ |
|
|
|
"'round midnight jazz and blues bar" |
|
|
|
'\'round midnight jazz and blues bar' |
|
|
|
], |
|
|
|
], |
|
|
|
"output": "osmnode:2208150035" |
|
|
|
'output': 'osmnode:2208150035' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"_id": "id2", |
|
|
|
'_id': 'id2', |
|
|
|
"_type": "type2", |
|
|
|
'_type': 'type2', |
|
|
|
"type": "way", |
|
|
|
'type': 'way', |
|
|
|
"name": { |
|
|
|
'name': { |
|
|
|
"default": "Blues Cafe" |
|
|
|
'default': 'Blues Cafe' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"center_point": { |
|
|
|
'center_point': { |
|
|
|
"lat": "51.517806", |
|
|
|
'lat': '51.517806', |
|
|
|
"lon": "-0.101795" |
|
|
|
'lon': '-0.101795' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"alpha3": "GBR", |
|
|
|
'alpha3': 'GBR', |
|
|
|
"admin0": "United Kingdom", |
|
|
|
'admin0': 'United Kingdom', |
|
|
|
"admin1": "City And County Of The City Of London", |
|
|
|
'admin1': 'City And County Of The City Of London', |
|
|
|
"admin1_abbr": "COL", |
|
|
|
'admin1_abbr': 'COL', |
|
|
|
"admin2": "Smithfield", |
|
|
|
'admin2': 'Smithfield', |
|
|
|
"local_admin": "test1", |
|
|
|
'local_admin': 'test1', |
|
|
|
"locality": "test2", |
|
|
|
'locality': 'test2', |
|
|
|
"neighborhood": "test3", |
|
|
|
'neighborhood': 'test3', |
|
|
|
"suggest": { |
|
|
|
'suggest': { |
|
|
|
"input": [ |
|
|
|
'input': [ |
|
|
|
"blues cafe" |
|
|
|
'blues cafe' |
|
|
|
], |
|
|
|
], |
|
|
|
"output": "osmway:147495160" |
|
|
|
'output': 'osmway:147495160' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"_id": "34633854", |
|
|
|
'_id': '34633854', |
|
|
|
"_type": "osmway", |
|
|
|
'_type': 'osmway', |
|
|
|
"type": "osmway", |
|
|
|
'type': 'osmway', |
|
|
|
"name": { |
|
|
|
'name': { |
|
|
|
"default": "Empire State Building" |
|
|
|
'default': 'Empire State Building' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"center_point": { |
|
|
|
'center_point': { |
|
|
|
"lat": "40.748432", |
|
|
|
'lat': '40.748432', |
|
|
|
"lon": "-73.985656" |
|
|
|
'lon': '-73.985656' |
|
|
|
}, |
|
|
|
}, |
|
|
|
"alpha3": "USA", |
|
|
|
'alpha3': 'USA', |
|
|
|
"admin0": "United States", |
|
|
|
'admin0': 'United States', |
|
|
|
"admin1": "New York", |
|
|
|
'admin1': 'New York', |
|
|
|
"admin1_abbr": "NY", |
|
|
|
'admin1_abbr': 'NY', |
|
|
|
"admin2": "New York", |
|
|
|
'admin2': 'New York', |
|
|
|
"local_admin": "Manhattan", |
|
|
|
'local_admin': 'Manhattan', |
|
|
|
"locality": "New York", |
|
|
|
'locality': 'New York', |
|
|
|
"neighborhood": "Koreatown", |
|
|
|
'neighborhood': 'Koreatown', |
|
|
|
"suggest": { |
|
|
|
'suggest': { |
|
|
|
"input": [ |
|
|
|
'input': [ |
|
|
|
"empire state building" |
|
|
|
'empire state building' |
|
|
|
], |
|
|
|
], |
|
|
|
"output": "osmway:34633854" |
|
|
|
'output': 'osmway:34633854' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
]; |
|
|
|
]; |
|
|
|
|
|
|
|
|
|
|
|
var expected = { |
|
|
|
var expected = { |
|
|
|
"type": "FeatureCollection", |
|
|
|
'type': 'FeatureCollection', |
|
|
|
"bbox": [ -73.985656, 40.748432, -0.101795, 51.5337144 ], |
|
|
|
'bbox': [ -73.985656, 40.748432, -0.101795, 51.5337144 ], |
|
|
|
"features": [ |
|
|
|
'features': [ |
|
|
|
{ |
|
|
|
{ |
|
|
|
"type": "Feature", |
|
|
|
'type': 'Feature', |
|
|
|
"geometry": { |
|
|
|
'geometry': { |
|
|
|
"type": "Point", |
|
|
|
'type': 'Point', |
|
|
|
"coordinates": [ |
|
|
|
'coordinates': [ |
|
|
|
-0.1069716, |
|
|
|
-0.1069716, |
|
|
|
51.5337144 |
|
|
|
51.5337144 |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
"properties": { |
|
|
|
'properties': { |
|
|
|
"id": "id1", |
|
|
|
'id': 'id1', |
|
|
|
"type": "type1", |
|
|
|
'type': 'type1', |
|
|
|
"layer": "type1", |
|
|
|
'layer': 'type1', |
|
|
|
"text": "'Round Midnight Jazz and Blues Bar, test3, Angel", |
|
|
|
'text': '\'Round Midnight Jazz and Blues Bar, test3, Angel', |
|
|
|
"name": "'Round Midnight Jazz and Blues Bar", |
|
|
|
'name': '\'Round Midnight Jazz and Blues Bar', |
|
|
|
"alpha3": "GBR", |
|
|
|
'alpha3': 'GBR', |
|
|
|
"admin0": "United Kingdom", |
|
|
|
'admin0': 'United Kingdom', |
|
|
|
"admin1": "Islington", |
|
|
|
'admin1': 'Islington', |
|
|
|
"admin1_abbr": "ISL", |
|
|
|
'admin1_abbr': 'ISL', |
|
|
|
"admin2": "Angel", |
|
|
|
'admin2': 'Angel', |
|
|
|
"local_admin": "test1", |
|
|
|
'local_admin': 'test1', |
|
|
|
"locality": "test2", |
|
|
|
'locality': 'test2', |
|
|
|
"neighborhood": "test3" |
|
|
|
'neighborhood': 'test3' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"type": "Feature", |
|
|
|
'type': 'Feature', |
|
|
|
"geometry": { |
|
|
|
'geometry': { |
|
|
|
"type": "Point", |
|
|
|
'type': 'Point', |
|
|
|
"coordinates": [ |
|
|
|
'coordinates': [ |
|
|
|
-0.101795, |
|
|
|
-0.101795, |
|
|
|
51.517806 |
|
|
|
51.517806 |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
"properties": { |
|
|
|
'properties': { |
|
|
|
"id": "id2", |
|
|
|
'id': 'id2', |
|
|
|
"type": "type2", |
|
|
|
'type': 'type2', |
|
|
|
"layer": "type2", |
|
|
|
'layer': 'type2', |
|
|
|
"text": "Blues Cafe, test3, Smithfield", |
|
|
|
'text': 'Blues Cafe, test3, Smithfield', |
|
|
|
"name": "Blues Cafe", |
|
|
|
'name': 'Blues Cafe', |
|
|
|
"alpha3": "GBR", |
|
|
|
'alpha3': 'GBR', |
|
|
|
"admin0": "United Kingdom", |
|
|
|
'admin0': 'United Kingdom', |
|
|
|
"admin1": "City And County Of The City Of London", |
|
|
|
'admin1': 'City And County Of The City Of London', |
|
|
|
"admin1_abbr": "COL", |
|
|
|
'admin1_abbr': 'COL', |
|
|
|
"admin2": "Smithfield", |
|
|
|
'admin2': 'Smithfield', |
|
|
|
"local_admin": "test1", |
|
|
|
'local_admin': 'test1', |
|
|
|
"locality": "test2", |
|
|
|
'locality': 'test2', |
|
|
|
"neighborhood": "test3" |
|
|
|
'neighborhood': 'test3' |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
}, |
|
|
|
{ |
|
|
|
{ |
|
|
|
"type": "Feature", |
|
|
|
'type': 'Feature', |
|
|
|
"geometry": { |
|
|
|
'geometry': { |
|
|
|
"type": "Point", |
|
|
|
'type': 'Point', |
|
|
|
"coordinates": [ |
|
|
|
'coordinates': [ |
|
|
|
-73.985656, |
|
|
|
-73.985656, |
|
|
|
40.748432 |
|
|
|
40.748432 |
|
|
|
] |
|
|
|
] |
|
|
|
}, |
|
|
|
}, |
|
|
|
"properties": { |
|
|
|
'properties': { |
|
|
|
"id": "34633854", |
|
|
|
'id': '34633854', |
|
|
|
"type": "osmway", |
|
|
|
'type': 'osmway', |
|
|
|
"layer": "osmway", |
|
|
|
'layer': 'osmway', |
|
|
|
"text": "Empire State Building, Manhattan, NY", |
|
|
|
'text': 'Empire State Building, Manhattan, NY', |
|
|
|
"name": "Empire State Building", |
|
|
|
'name': 'Empire State Building', |
|
|
|
"alpha3": "USA", |
|
|
|
'alpha3': 'USA', |
|
|
|
"admin0": "United States", |
|
|
|
'admin0': 'United States', |
|
|
|
"admin1": "New York", |
|
|
|
'admin1': 'New York', |
|
|
|
"admin1_abbr": "NY", |
|
|
|
'admin1_abbr': 'NY', |
|
|
|
"admin2": "New York", |
|
|
|
'admin2': 'New York', |
|
|
|
"local_admin": "Manhattan", |
|
|
|
'local_admin': 'Manhattan', |
|
|
|
"locality": "New York", |
|
|
|
'locality': 'New York', |
|
|
|
"neighborhood": "Koreatown" |
|
|
|
'neighborhood': 'Koreatown' |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
] |
|
|
|
] |
|
|
|