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

Emoji search returns no results for single letter queries #295 #298

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

abdullah4a
Copy link

has been fixed

@@ -271,7 +271,7 @@ $: {
if (!databaseLoaded) {
currentEmojis = []
searchMode = false
} else if (searchText.length >= MIN_SEARCH_TEXT_LENGTH) {
Copy link
Owner

Choose a reason for hiding this comment

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

MIN_SEARCH_TEXT_LENGTH is actually used in another place, so if we change from >= to > it would also need to be updated there:

.filter(_ => _.length >= MIN_SEARCH_TEXT_LENGTH)

To me, though, "minimum" implies >= rather than >, so it would make the most sense for MIN_SEARCH_TEXT_LENGTH to be 1.

@@ -1,2 +1,2 @@
export const MIN_SEARCH_TEXT_LENGTH = 2
Copy link
Owner

Choose a reason for hiding this comment

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

This has implications for the performance of the picker. For instance, when typing s, it returns a lot of results and so it may be slow. When I test on my laptop with 6x CPU throttling in Chrome, it takes ~1.3s to return this query. Whereas with two letters (e.g. sm), it takes 450ms.

Since people have to type one letter before they can type 2, it may make the UI appear sluggish.

So I prefer keeping the default at 2, but if people really want 1, they can change it themselves using something like patch-package.

Arguably we could make this a configuration option. That could be a footgun, since it affects both the database and the picker. But if people really want 1, maybe it's reasonable to make it configurable.

Copy link
Owner

@nolanlawson nolanlawson left a comment

Choose a reason for hiding this comment

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

See comments above. Thanks for the PR!

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.

None yet

2 participants