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

Sorting using ICU #1031

Open
kneth opened this issue Apr 15, 2015 · 11 comments
Open

Sorting using ICU #1031

kneth opened this issue Apr 15, 2015 · 11 comments
Assignees

Comments

@kneth
Copy link
Contributor

kneth commented Apr 15, 2015

Sorting is currently done in "English locale". Using Android's ICU library could make it possible to specify the locale to sort in.

@cmelchior
Copy link
Contributor

This would also fix #581

@saket
Copy link

saket commented Oct 29, 2015

Any updates on this? This drawback makes search kinda difficult for non-English users. I'm forced to manually iterate through RealmResult and compare text.

@kneth
Copy link
Contributor Author

kneth commented Oct 30, 2015

Sorry, we don't have updates on it. We fully understand searching and sorting for non-English character sets are painful. ICU is a very large dependency to add (our jar file could easily double in size), and we would like to find a best solution.

@saket
Copy link

saket commented Oct 30, 2015

Android already has ICU. Why add it again?

@kneth
Copy link
Contributor Author

kneth commented Oct 30, 2015

Different Android versions are using different ICU versions. And using non-NDK libraries in C++ code is often a bit cumbersome.

@saket
Copy link

saket commented Oct 30, 2015

Agreed with the NDK part, but choosing the version of ICU is your job. Android will do it automatically, right? Simply use the Locale APIs? Please correct if I'm wrong.

@kneth
Copy link
Contributor Author

kneth commented Nov 2, 2015

Using the Locale API implies that you will have to copy data (strings) between the JVM and our storage engine. It is definitely not acceptable from a performance perspective. Supporting ICU is important and we will get around the feature at some point.

@saket
Copy link

saket commented Nov 2, 2015

Ah, understood. Would you suggest any workaround in the meanwhile, other than iterating a table content manually?

@kneth
Copy link
Contributor Author

kneth commented Nov 2, 2015

If you are outside the range 0-591 (UTF-8), there is no easy workaround.

@cmelchior
Copy link
Contributor

For reference: realm/realm-core#1946

If we go the route where the bindings are responsible for sorting, we should look into building ICU specifically for a given app. Given the size of the default ICU (16 MB - http://userguide.icu-project.org/packaging) it will be unfeasible for most apps to package that.

If we automatically detected which languages are supported by an app, I think we could make a smart build of ICU with only the required languages. This is most likely not trivial though.

Right now ICU is only official supported in Android N through https://developer.android.com/preview/features/icu4j-framework.html, however there is no native support yet. The earliest that would happen is in O, and even then it will take years for it to become widely available.

Alternatively we should look into providing these tables in an alternative manner, e.g. we could create a special dependency with only the lookup table and distribute that as a normal dependency. Realm could then dynamically load these if found.

@cmelchior
Copy link
Contributor

Maybe there will soon be light at the end of the tunnel: android/ndk#548

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants