Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve unit number sorting for fallback.housenumber queries (/v1/search) #1683

Merged
merged 1 commit into from
Jan 22, 2025

Conversation

missinglink
Copy link
Member

@missinglink missinglink commented Jan 21, 2025

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 the phrase.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.

Screenshot 2025-01-21 at 22 23 16

resolves pelias/pelias#810

Some caveats which are worth noting but not an issue in practice:

  • If the parse contains the housenumber 1 (for instance) and the document name.default contains that token in any position (ie. 8 1 street) then it will get a boost. This is likely not an issue as the address_parts.street must match.
  • If the parse contains the housenumber 1 (for instance) and the document name.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.
  • If the parse contains the housenumber 1 F (for instance) and the document name.default contains the token 1F 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

@missinglink missinglink force-pushed the search-address-fallback-sorting branch from 6edf0c1 to fd205f8 Compare January 22, 2025 10:09
@missinglink missinglink marked this pull request as ready for review January 22, 2025 10:09
@missinglink missinglink merged commit a93894b into master Jan 22, 2025
6 checks passed
@missinglink missinglink deleted the search-address-fallback-sorting branch January 22, 2025 10:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Housenumber with letters results in wrong order
1 participant