Skip to content

Commit

Permalink
feat(query): improve unit number sorting for fallback.housenumber que…
Browse files Browse the repository at this point in the history
…ries
  • Loading branch information
missinglink committed Jan 21, 2025
1 parent c692c72 commit ea5f89c
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
6 changes: 5 additions & 1 deletion layout/StructuredFallbackQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@
}
],
"should": [
{
"match_phrase": {
"phrase.default": {
"query": "house number value"
}
}
},
{
"match_phrase": {
"address_parts.zip": {
Expand Down
10 changes: 9 additions & 1 deletion test/fixtures/structuredFallbackQuery/query.json
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,15 @@
}
}
],
"should": [],
"should": [
{
"match_phrase": {
"phrase.default": {
"query": "house number value"
}
}
}
],
"filter": {
"term": {
"layer": "address"
Expand Down

0 comments on commit ea5f89c

Please sign in to comment.