diff --git a/layout/StructuredFallbackQuery.js b/layout/StructuredFallbackQuery.js index 7e21a39..9d66360 100644 --- a/layout/StructuredFallbackQuery.js +++ b/layout/StructuredFallbackQuery.js @@ -264,7 +264,11 @@ function addHouseNumberAndStreet(vs) { match_phrase('address_parts.number', vs.var('input:housenumber')), match_phrase('address_parts.street', vs.var('input:street'), { slop: vs.var('address:street:slop') }) ], - should: [], + should: [ + // non-numeric tokens are stripped from the index, use the phrase field to improve sorting. + // see: https://github.com/pelias/pelias/issues/810 + match_phrase('phrase.default', vs.var('input:housenumber')) + ], filter: { term: { layer: 'address' diff --git a/test/fixtures/structuredFallbackQuery/address_with_postcode.json b/test/fixtures/structuredFallbackQuery/address_with_postcode.json index 65769db..59047dc 100644 --- a/test/fixtures/structuredFallbackQuery/address_with_postcode.json +++ b/test/fixtures/structuredFallbackQuery/address_with_postcode.json @@ -26,6 +26,13 @@ } ], "should": [ + { + "match_phrase": { + "phrase.default": { + "query": "house number value" + } + } + }, { "match_phrase": { "address_parts.zip": { diff --git a/test/fixtures/structuredFallbackQuery/query.json b/test/fixtures/structuredFallbackQuery/query.json index 17a7e35..39f71d7 100644 --- a/test/fixtures/structuredFallbackQuery/query.json +++ b/test/fixtures/structuredFallbackQuery/query.json @@ -183,7 +183,15 @@ } } ], - "should": [], + "should": [ + { + "match_phrase": { + "phrase.default": { + "query": "house number value" + } + } + } + ], "filter": { "term": { "layer": "address"