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. 12
      test/unit/query/search.js
  5. 12
      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'
}

12
test/unit/query/search.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'
}

12
test/unit/query/sort.js

@ -21,24 +21,24 @@ 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'
}

Loading…
Cancel
Save