Browse Source

Use address_weights.js in tests instead of hardcoding boost values

pull/192/head
Diana Shkolnikov 10 years ago
parent
commit
49d439425e
  1. 18
      test/unit/query/search.js

18
test/unit/query/search.js

@ -7,8 +7,10 @@ var category = 'category';
var parser = require('../../../helper/query_parser'); var parser = require('../../../helper/query_parser');
var category_weights = require('../../../helper/category_weights'); var category_weights = require('../../../helper/category_weights');
var admin_weights = require('../../../helper/admin_weights'); var admin_weights = require('../../../helper/admin_weights');
var address_weights = require('../../../helper/address_weights');
var weights = require('pelias-suggester-pipeline').weights; var weights = require('pelias-suggester-pipeline').weights;
module.exports.tests = {}; module.exports.tests = {};
module.exports.tests.interface = function(test, common) { module.exports.tests.interface = function(test, common) {
@ -269,7 +271,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'address.number': { 'address.number': {
'query': 123, 'query': 123,
'boost': 1 'boost': address_weights.number
} }
} }
}, },
@ -277,7 +279,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'address.street': { 'address.street': {
'query': 'main st', 'query': 'main st',
'boost': 3 'boost': address_weights.street
} }
} }
}, },
@ -285,7 +287,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'address.zip': { 'address.zip': {
'query': 10010, 'query': 10010,
'boost': 3 'boost': address_weights.zip
} }
} }
}, },
@ -293,7 +295,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'admin1_abbr': { 'admin1_abbr': {
'query': 'NY', 'query': 'NY',
'boost': 3 'boost': address_weights.admin1_abbr
} }
} }
}, },
@ -301,7 +303,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'alpha3': { 'alpha3': {
'query': 'USA', 'query': 'USA',
'boost': 5 'boost': address_weights.alpha3
} }
} }
}, },
@ -623,7 +625,7 @@ module.exports.tests.query = function(test, common) {
match: { match: {
'address.number': { 'address.number': {
'query': 1, 'query': 1,
'boost': 1 'boost': address_weights.number
} }
} }
}, },
@ -631,7 +633,7 @@ module.exports.tests.query = function(test, common) {
match: { match: {
'address.street': { 'address.street': {
'query': 'water st', 'query': 'water st',
'boost': 3 'boost': address_weights.street
} }
} }
}, },
@ -639,7 +641,7 @@ module.exports.tests.query = function(test, common) {
'match': { 'match': {
'admin1_abbr': { 'admin1_abbr': {
'query': 'NY', 'query': 'NY',
'boost': 3 'boost': address_weights.admin1_abbr
} }
} }
}, },

Loading…
Cancel
Save