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.
31 lines
673 B
31 lines
673 B
|
|
var logger = require('../src/logger'); |
|
|
|
// Build pelias suggest query |
|
function generate( params ){ |
|
|
|
var cmd = { |
|
'pelias' : { |
|
'text' : params.input, |
|
'completion' : { |
|
'size' : params.size, |
|
'field' : 'suggest', |
|
'context': { |
|
'dataset': params.layers, |
|
'location': { |
|
'value': [ params.lon, params.lat ], |
|
|
|
// // commented out until they fix the precision bug in ES 1.3.3 |
|
'precision': 2 // params.zoom > 9 ? 3 : (params.zoom > 7 ? 2 : 1) |
|
} |
|
} |
|
} |
|
} |
|
}; |
|
|
|
// logger.log( 'cmd', JSON.stringify( cmd, null, 2 ) ); |
|
return cmd; |
|
|
|
} |
|
|
|
module.exports = generate; |