diff --git a/query/sort.js b/query/sort.js index 7102651f..d79f39b8 100644 --- a/query/sort.js +++ b/query/sort.js @@ -1,4 +1,5 @@ var population = 'population'; +var popularity = 'popularity'; var weights = require('pelias-suggester-pipeline').weights; module.exports = [ @@ -9,6 +10,13 @@ module.exports = [ 'order': 'desc' } }, + { + '_script': { + 'file': popularity, + 'type': 'number', + 'order': 'desc' + } + }, { '_script': { 'params': { diff --git a/test/unit/query/reverse.js b/test/unit/query/reverse.js index 26c5e7e9..08550c71 100644 --- a/test/unit/query/reverse.js +++ b/test/unit/query/reverse.js @@ -1,5 +1,7 @@ var generate = require('../../../query/reverse'); +var population = 'population'; +var popularity = 'popularity'; var weights = require('pelias-suggester-pipeline').weights; module.exports.tests = {}; @@ -15,7 +17,14 @@ var sort = [ '_score', { '_script': { - 'file': 'population', + 'file': population, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'file': popularity, 'type': 'number', 'order': 'desc' } diff --git a/test/unit/query/search.js b/test/unit/query/search.js index 3e9d72f0..d47246b6 100644 --- a/test/unit/query/search.js +++ b/test/unit/query/search.js @@ -1,5 +1,7 @@ var generate = require('../../../query/search'); +var population = 'population'; +var popularity = 'popularity'; var weights = require('pelias-suggester-pipeline').weights; module.exports.tests = {}; @@ -15,7 +17,14 @@ var sort = [ '_score', { '_script': { - 'file': 'population', + 'file': population, + 'type': 'number', + 'order': 'desc' + } + }, + { + '_script': { + 'file': popularity, 'type': 'number', 'order': 'desc' } diff --git a/test/unit/query/sort.js b/test/unit/query/sort.js index ad5f9037..95e2a02e 100644 --- a/test/unit/query/sort.js +++ b/test/unit/query/sort.js @@ -1,6 +1,7 @@ var generate = require('../../../query/sort'); var population = 'population'; +var popularity = 'popularity'; var weights = require('pelias-suggester-pipeline').weights; module.exports.tests = {}; @@ -20,6 +21,13 @@ var expected = [ 'order': 'desc' } }, + { + '_script': { + 'file': popularity, + 'type': 'number', + 'order': 'desc' + } + }, { '_script': { 'params': {