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

Enable using location search with shorter place names #671

Merged
merged 2 commits into from
Sep 26, 2024

Conversation

lliehu
Copy link
Contributor

@lliehu lliehu commented Jun 24, 2023

This is the first attempt at fixing problems with location search when Chinese or other similar languages are used. Please see commit messages for details.

Related issue is: #538

Tested manually on both Firefox and Brave. It looks like the used select component has more strange issues. Was not able to fix those but also checked that I didn't create more issues. The react-select version is quite old: ^1.0.0-rc.5 in package.json while latest release is 5.7.3.

Nominatim does not return prefix matches, so it could be good
to even remove this minimum limit. However, searches with only
a single Latin letter can take more than 1 second on Nominatim's
end. So, perhaps it's good to first relax the global limit to
2 characters and have additional logic that there is no minimum
limit if the input text contains characters from certain scripts.
Make the minimum limit depend on the input characters.
No limit is used if the input contains characters that are used
in the following CJK scripts: Han, Hangul, Hiragana and Katakana.
These scripts were chosen because there are place names that can
be written with 1 character in Han, Hiragana and Katakana. In Hangul,
it looks possible that such place names exist and often an input
method similar to the other scripts is used, which reduces
the probability of triggering search with only 1 character
when the user has not yet finished typing. New scripts can be added
to the regular expression with a similar reasoning.

`scx` is used in the regular expression because `Script_Extensions`
is a more useful property than `Script` when a single Unicode character
can be used in multiple scripts.

It would be even simpler to just remove the limit completely because
Nominatim does not return prefix matches. However, at least queries
that contain only 1 Latin letter take longer than queries with at least
a few characters. Also, the component that displays the results seems
to have some kind of problem displaying the results for the subsequent
queries and this problem might become more apparent for more users
if the character limit is removed.
@lliehu
Copy link
Contributor Author

lliehu commented Aug 14, 2023

@willemarcel Could I request your review on this?

GitHub doesn't allow me to add any reviewers to this PR. I hope you forgive this ping after weeks of waiting and not understanding how to better request a review from someone in this project.

@willemarcel
Copy link
Collaborator

@lliehu sorry for the delay and thanks for the PR. I'll review it this week.

Copy link
Contributor

@jake-low jake-low left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing to OSMCha and for your patience while waiting for us to review this. I reviewed and tested the change, and everything looks good.

@jake-low jake-low merged commit 0cfa383 into OSMCha:master Sep 26, 2024
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.

3 participants