mirror of https://github.com/pelias/api.git
Harish Krishna
10 years ago
6 changed files with 44 additions and 8 deletions
@ -0,0 +1,27 @@
|
||||
var population = 'population'; |
||||
var weights = require('pelias-model').weights; |
||||
|
||||
module.exports = [ |
||||
{ |
||||
'_script': { |
||||
'script': 'if (doc.containsKey(\''+ population + '\'))' + |
||||
' { return doc[\'' + population + '\'].value }' + |
||||
' else { return 0 }', |
||||
'type': 'number', |
||||
'order': 'desc' |
||||
} |
||||
}, |
||||
{ |
||||
'_script': { |
||||
'params': { |
||||
'weights': weights |
||||
}, |
||||
'script': 'if (doc.containsKey(\'_type\')) { '+ |
||||
'type=doc[\'_type\'].value; '+ |
||||
'return ( type in weights ) ? weights[ type ] : 0 }' + |
||||
'else { return 0 }', |
||||
'type': 'number', |
||||
'order': 'desc' |
||||
} |
||||
} |
||||
]; |
Loading…
Reference in new issue