Browse Source

adding popularity to sort scoring function list

pull/71/head
Harish Krishna 10 years ago
parent
commit
79f33dee96
  1. 8
      query/sort.js
  2. 11
      test/unit/query/reverse.js
  3. 11
      test/unit/query/search.js
  4. 8
      test/unit/query/sort.js

8
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': {

11
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'
}

11
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'
}

8
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': {

Loading…
Cancel
Save