mirror of https://github.com/pelias/api.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
412 B
19 lines
412 B
|
|
var logger = require('../src/logger'), |
|
queries = require('geopipes-elasticsearch-backend').queries, |
|
sort = require('../query/sort'); |
|
|
|
function generate( params ){ |
|
|
|
var centroid = { |
|
lat: params.lat, |
|
lon: params.lon |
|
}; |
|
|
|
var query = queries.distance( centroid, { size: params.size || 1 } ); |
|
query.sort = query.sort.concat( sort( params ) ); |
|
|
|
return query; |
|
} |
|
|
|
module.exports = generate;
|
|
|