improve unit number sorting for fallback.housenumber
queries (/v1/search
)
#1683
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue as described in pelias/pelias#810
ref: pelias/query#139
This PR resolves a long-standing issue with
/v1/search
where exact matches of unit numbers are not given priority in the sorting.This is accomplished by adding a 'should' condition to all
fallback.address
queries which uses the original housenumber as parsed by libpostal (including both alpha an numeric tokens) to match against thephrase.default
field, increasing its score slightly compared to the other matches.The reason this is required is because the existing
match_phrase
address_parts.number
query uses a tokenizer which strips non-numeric tokens.resolves pelias/pelias#810
Some caveats which are worth noting but not an issue in practice:
1
(for instance) and the documentname.default
contains that token in any position (ie.8 1 street
) then it will get a boost. This is likely not an issue as theaddress_parts.street
must match.1
(for instance) and the documentname.default
contains that token multiple times (ie.1/1 main street
) then it will get multiple boosts. This is likely not an issue but worth keeping an eye on.1 F
(for instance) and the documentname.default
contains the token1F
then it will get no boost. This is something we might be able to improve.https://pelias.github.io/compare/#/v1/search?text=kinkerstraat+175F&debug=1