Browse Source

Merge branch 'master' of github.com:pelias/api

pull/11/head
Peter Johnson 10 years ago
parent
commit
eb53200026
  1. 2
      controller/search.js
  2. 8
      query/search.js

2
controller/search.js

@ -21,7 +21,7 @@ function setup( backend, query ){
// handle backend errors
if( err ){ return next( err ); }
if( data && data.hits && data.hits.total){
if( data && data.hits && data.hits.total && Array.isArray(data.hits.hits)){
docs = data.hits.hits.map( function( hit ){
return hit._source;
});

8
query/search.js

@ -2,7 +2,7 @@ var logger = require('../src/logger');
// Build pelias search query
function generate( params ){
var cmd = {
"query":{
"filtered" : {
@ -15,8 +15,8 @@ function generate( params ){
"geo_distance" : {
"distance" : "200km",
"center_point" : {
"lat": params.lat,
"lon": params.lon
"lat": params.lat,
"lon": params.lon
}
}
}
@ -25,7 +25,7 @@ function generate( params ){
"size": params.size
};
logger.log( 'cmd', JSON.stringify( cmd, null, 2 ) );
// logger.log( 'cmd', JSON.stringify( cmd, null, 2 ) );
return cmd;
}

Loading…
Cancel
Save