Browse Source

moving sort logic.. popularity then population first!

pull/169/head
Harish Krishna 10 years ago
parent
commit
f78f49d857
  1. 2
      helper/admin_weights.js
  2. 12
      query/sort.js
  3. 12
      test/unit/query/reverse.js
  4. 14
      test/unit/query/search.js
  5. 16
      test/unit/query/sort.js

2
helper/admin_weights.js

@ -6,7 +6,7 @@
module.exports = {
'admin0': 4,
'admin1': 3,
'admin2': 1,
'admin2': 2,
'local_admin': 1,
'locality':1,
'neighborhood':1

12
query/sort.js

@ -11,24 +11,24 @@ module.exports = function( params ){
var scriptsConfig = [
{
'_script': {
'params': {
'weights': admin_weights
},
'file': 'weights',
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': population,
'params': {
'weights': admin_weights
},
'file': 'weights',
'type': 'number',
'order': 'desc'
}

12
test/unit/query/reverse.js

@ -21,24 +21,24 @@ var sort = [
'_score',
{
'_script': {
'params': {
'weights': admin_weights
},
'file': 'weights',
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': population,
'params': {
'weights': admin_weights
},
'file': 'weights',
'type': 'number',
'order': 'desc'
}

14
test/unit/query/search.js

@ -19,26 +19,26 @@ module.exports.tests.interface = function(test, common) {
var sort = [
'_score',
{
{
'_script': {
'params': {
'weights': admin_weights
},
'file': 'weights',
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': population,
'params': {
'weights': admin_weights
},
'file': 'weights',
'type': 'number',
'order': 'desc'
}

16
test/unit/query/sort.js

@ -19,31 +19,31 @@ module.exports.tests.interface = function(test, common) {
};
var expected = [
{
{
'_script': {
'params': {
'weights': admin_weights
},
'file': 'weights',
'file': popularity,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': popularity,
'file': population,
'type': 'number',
'order': 'desc'
}
},
{
'_script': {
'file': population,
'params': {
'weights': admin_weights
},
'file': 'weights',
'type': 'number',
'order': 'desc'
}
},
{
{
'_script': {
'params': {
'category_weights': category_weights

Loading…
Cancel
Save