pelias-query
Advanced tools
Comparing version 8.7.0 to 8.8.0
@@ -26,14 +26,4 @@ module.exports = { | ||
sort: [ | ||
{ | ||
population: { | ||
order: 'desc' | ||
} | ||
}, | ||
{ | ||
popularity: { | ||
order: 'desc' | ||
} | ||
}, | ||
'_score' | ||
] | ||
}; |
@@ -252,2 +252,6 @@ // This query is useful for specifying all the combinations of inputs starting | ||
if (vs.isset('boost:address')) { | ||
o.bool.boost = vs.var('boost:address'); | ||
} | ||
addSecPostCode(vs, o); | ||
@@ -285,2 +289,6 @@ addSecNeighbourhood(vs, o); | ||
if (vs.isset('boost:street')) { | ||
o.bool.boost = vs.var('boost:street'); | ||
} | ||
addSecPostCode(vs, o); | ||
@@ -287,0 +295,0 @@ addSecNeighbourhood(vs, o); |
{ | ||
"name": "pelias-query", | ||
"version": "8.7.0", | ||
"version": "8.8.0", | ||
"description": "An Elasticsearch query builder for Pelias", | ||
@@ -5,0 +5,0 @@ "engines": { |
@@ -12,2 +12,3 @@ { | ||
"_name": "fallback.address", | ||
"boost": { "$": 19 }, | ||
"must": [ | ||
@@ -42,2 +43,3 @@ { | ||
"_name": "fallback.street", | ||
"boost": { "$": 17 }, | ||
"must": [ | ||
@@ -83,14 +85,4 @@ { | ||
"sort": [ | ||
{ | ||
"population": { | ||
"order": "desc" | ||
} | ||
}, | ||
{ | ||
"popularity": { | ||
"order": "desc" | ||
} | ||
}, | ||
"_score" | ||
] | ||
} |
@@ -47,14 +47,4 @@ { | ||
"sort": [ | ||
{ | ||
"population": { | ||
"order": "desc" | ||
} | ||
}, | ||
{ | ||
"popularity": { | ||
"order": "desc" | ||
} | ||
}, | ||
"_score" | ||
] | ||
} |
@@ -27,14 +27,4 @@ { | ||
"sort": [ | ||
{ | ||
"population": { | ||
"order": "desc" | ||
} | ||
}, | ||
{ | ||
"popularity": { | ||
"order": "desc" | ||
} | ||
}, | ||
"_score" | ||
] | ||
} |
@@ -101,2 +101,3 @@ { | ||
"_name": "fallback.address", | ||
"boost": { "$": 19 }, | ||
"must": [ | ||
@@ -193,2 +194,3 @@ { | ||
"_name": "fallback.street", | ||
"boost": { "$": 17 }, | ||
"must": [ | ||
@@ -766,14 +768,4 @@ { | ||
"sort": [ | ||
{ | ||
"population": { | ||
"order": "desc" | ||
} | ||
}, | ||
{ | ||
"popularity": { | ||
"order": "desc" | ||
} | ||
}, | ||
"_score" | ||
] | ||
} |
@@ -12,2 +12,3 @@ { | ||
"_name": "fallback.address", | ||
"boost": { "$": 19 }, | ||
"must": [ | ||
@@ -104,2 +105,3 @@ { | ||
"_name": "fallback.street", | ||
"boost": { "$": 17 }, | ||
"must": [ | ||
@@ -677,14 +679,4 @@ { | ||
"sort": [ | ||
{ | ||
"population": { | ||
"order": "desc" | ||
} | ||
}, | ||
{ | ||
"popularity": { | ||
"order": "desc" | ||
} | ||
}, | ||
"_score" | ||
] | ||
} |
@@ -54,2 +54,4 @@ var FallbackQuery = require('../../layout/FallbackQuery'); | ||
vs.var('input:country', 'country value'); | ||
vs.var('boost:address', 19); | ||
vs.var('boost:street', 17); | ||
@@ -78,2 +80,4 @@ var actual = query.render(vs); | ||
vs.var('input:country', 'country value'); | ||
vs.var('boost:address', 19); | ||
vs.var('boost:street', 17); | ||
@@ -97,2 +101,4 @@ var actual = query.render(vs); | ||
vs.var('input:postcode', 'postcode value'); | ||
vs.var('boost:address', 19); | ||
vs.var('boost:street', 17); | ||
@@ -111,2 +117,22 @@ var fs = require('fs'); | ||
module.exports.tests.boosts = function(test, common) { | ||
test('boost:street and boost:address missing from vs should not be include empty string', function(t) { | ||
var query = new FallbackQuery(); | ||
var vs = new VariableStore(); | ||
vs.var('size', 'size value'); | ||
vs.var('track_scores', 'track_scores value'); | ||
vs.var('input:housenumber', 'house number value'); | ||
vs.var('input:street', 'street value'); | ||
var actual = query.render(vs); | ||
t.false(actual.query.function_score.query.filtered.query.bool.should[0].bool.hasOwnProperty('boost')); | ||
t.false(actual.query.function_score.query.filtered.query.bool.should[1].bool.hasOwnProperty('boost')); | ||
t.end(); | ||
}); | ||
}; | ||
module.exports.tests.scores = function(test, common) { | ||
@@ -113,0 +139,0 @@ test('scores rendering to falsy values should not be added', function(t) { |
209280
5645