[search] Improve search ranking behavior #1661

Merged
bnitkin merged 1 commit from improved-search into master 2021-12-09 04:12:16 +00:00

1 commit

Author SHA1 Message Date
Ben Nitkin
5c2fa4463a [search] Improve search ranking behavior
This PR fixes some bugs in search rankings, and should make search more
usable, especially for partial matches and buildings whose numbers aren't
yet in OSM. I think it'll help with some of the issues linked in #1560.

Overview of changes:
 - New synonyms: rd/st/ct are recognized as road/street/court
 - Synonyms supported for final token in search: previously,
   "S Fred St" wouldn't use synonym matching, but "S Fred St "
   would. Now both behave the same.
 - Fixed matchedLength: `matchedLength` now represents the
   number of characters in the query that matched the specific
   result. Previously, some items had `matchedFraction` values
   in excess of 1.0.
 - Leave suggestions available as results: search now presents
   the results used to create suggestions as suggestions and results,
   instead of removing the result.
 - New `GetNameScore`: It now computes matchLength, and uses
   more descriptive variable names & comments.

See the pull request for more details.

Signed-off-by: Ben Nitkin <ben@nitkin.net>
2021-12-08 20:55:11 -07:00