On 22/05/13 16:45, Eugene Seo wrote:
Dear all,
Hello Eugene,
I have a question of tracker sparql query order with multi langauges.
Currently tracker supports Sparql 1.0 and sorts the result in unicode
order, as I know.
Yes it does.
Is it possible to sort other language prior to English?
Usually sorting by different languages is done by the locale
settings/environment. Sorting by language per query isn't currently
possible because we build collations based on the language being used.
If you change language, we rebuild those collations in the database.
In SQLite, specific chacracters can be sorted in front with following
syntax,
ORDER BY (CASE WHEN str between '0' and '9' THEN 1 WHEN str between 'a'
and 'z' THEN 2 ELSE 3 END)
This is pretty cool and I didn't know about this I have to say.
I wonder there is similar syntax of SPARQL query like CASE WHEN THEN of
SQLITE.
Well, the SPARQL in Tracker is interpreted, some of it (like ORDER BY)
is used directly for the SQL used in SQLite. I haven't actually tried
the example you suggest above, have you? I am curious to know if you
tested this yet? :)
If there is any way to sort other langague first than English, please
share with me.
What's interesting here is, that we use libicu or libunistring for the
collation/sorting. Whether this works or not depends on a few things:
1. We need to fix our parser to allow the CASE/WHEN/END system. A quick
test here shows we don't allow that right now.
2. I don't actually know how SQLite would treat such a query on a
collated column, we would need to figure this part out.
If those two steps work, Tracker should support it.
--
Can I ask how you're using tracker to understand why you need to sort
for different languages by query?
Thanks,
--
Regards,
Martyn
Founder and CEO of Lanedo GmbH.
_______________________________________________
tracker-list mailing list
tracker-list@gnome.org
https://mail.gnome.org/mailman/listinfo/tracker-list