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.
 
 

30 lines
620 B

var logger = require('../src/logger'),
queries = require('geopipes-elasticsearch-backend').queries;
function generate( params ){
var centroid = {
lat: params.lat,
lon: params.lon
};
var query = queries.distance( centroid, { size: params.size } );
if (params.bbox) {
query = queries.bbox ( centroid, { size: params.size, bbox: params.bbox } );
}
// add search condition to distance query
query.query.filtered.query = {
query_string : {
query: params.input,
fields: ['name.default'],
default_operator: 'OR'
}
};
return query;
}
module.exports = generate;