Browse Source

Merge pull request #71 from pelias/add-popularity

adding popularity to sort scoring function list
pull/74/merge
Harish Krishna 10 years ago
parent
commit
73bf83275e
  1. 8
      query/sort.js
  2. 14
      test/unit/query/reverse.js
  3. 14
      test/unit/query/search.js
  4. 11
      test/unit/query/sort.js

8
query/sort.js

@ -1,5 +1,6 @@
var admin_boost = 'admin_boost';
var population = 'population';
var popularity = 'popularity';
var weights = require('pelias-suggester-pipeline').weights;
module.exports = [
@ -17,6 +18,13 @@ module.exports = [
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'params': {

14
test/unit/query/reverse.js

@ -1,5 +1,8 @@
var generate = require('../../../query/reverse');
var admin_boost = 'admin_boost';
var population = 'population';
var popularity = 'popularity';
var weights = require('pelias-suggester-pipeline').weights;
module.exports.tests = {};
@ -15,14 +18,21 @@ var sort = [
'_score',
{
'_script': {
'file': 'admin_boost',
'file': admin_boost,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': 'population',
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'type': 'number',
'order': 'desc'
}

14
test/unit/query/search.js

@ -1,5 +1,8 @@
var generate = require('../../../query/search');
var admin_boost = 'admin_boost';
var population = 'population';
var popularity = 'popularity';
var weights = require('pelias-suggester-pipeline').weights;
module.exports.tests = {};
@ -15,14 +18,21 @@ var sort = [
'_score',
{
'_script': {
'file': 'admin_boost',
'file': admin_boost,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': 'population',
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'type': 'number',
'order': 'desc'
}

11
test/unit/query/sort.js

@ -1,6 +1,8 @@
var generate = require('../../../query/sort');
var admin_boost = 'admin_boost';
var population = 'population';
var popularity = 'popularity';
var weights = require('pelias-suggester-pipeline').weights;
module.exports.tests = {};
@ -15,7 +17,7 @@ module.exports.tests.interface = function(test, common) {
var expected = [
{
'_script': {
'file': 'admin_boost',
'file': admin_boost,
'type': 'number',
'order': 'desc'
}
@ -27,6 +29,13 @@ var expected = [
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'params': {

Loading…
Cancel
Save