Skip to main content
Inspiring
August 11, 2008
Question

icu4jSortQuery

  • August 11, 2008
  • 1 reply
  • 366 views
Hi Paul or anyone else who may have understanding on this,

I have a few questions on this method you created for sorting the query.

1. Since this method was created using icu4j collator, does it mean that the <cfquery> tag for cf doesn't return a correct sorting especially for Farsi where CF doesn't support? Let's assume a certain scenario. What if my db, Oracle, happens to support Farsi. Is it still recommended to use the icu4jSortQuery method? If so, how would this affect the performance especially in the speed?

2. For query of query in CF, this will definitely not return a correct sorting order even if Oracle supports Farsi since query of query in CF is CF level. How can we use the icu4jSortQuery? Or maybe this is not the method to be used, right?

3. Also, correct me if I'm wrong, the icu4jSortQuery is only meant for sorting 1 column?


Thanks.
This topic has been closed for replies.

1 reply

Inspiring
August 11, 2008
dongzky wrote:
> 1. Since this method was created using icu4j collator, does it mean that the
> <cfquery> tag for cf doesn't return a correct sorting especially for Farsi
> where CF doesn't support? Let's assume a certain scenario. What if my db,

no, this was primarily for use w/query of query or array sort which always used
unicdoe code point value, which for some collations is incorrect.

> Oracle, happens to support Farsi. Is it still recommended to use the

use the db.

> order even if Oracle supports Farsi since query of query in CF is CF level. How
> can we use the icu4jSortQuery? Or maybe this is not the method to be used,
> right?

no, you need to test that assumption first. using the code point value's not
always wrong, only for *some* collations (i'm not 100% sure about farsi but i
might guess it won't sort correctly as farsi's not arabic like french & german
sort the same char differently). try a regular QofQ first, then the core java
one (though the icu4j one should perform better).

the info on how to install & use that CFC is contained in the CFC itself:

- icu4jSortQuery returns query sorted on given collate locale. required
arguments are
toSort, query to sort,
sortColumn column in toSort to use in collation. this sort is based on
icu4j lib com.ibm.icu.text.Collator class.

other non-required arguments:
-- sortDir direction to sort query on, Asc (ascending) or Desc (descending).
default is Asc
-- retainSortID boolean indicating whether to return generated collate sort ID,
default is false
-- thisLocale java style locale (en_US, th_TH, etc.) to base collation on.
defaults to en_US
-- thisStrength collator strength value, sets level of comparison difference,
valid values are IDENTICAL, PRIMARY, SECONDARY, QUATERNARY and the default of
TERTIARY. the exact assignment of strengths varies locale to locale
-- thisDecomposition determines how strings are decomposed in comparison. valid
values:
--- NO_DECOMPOSITION ignores accents, etc. fastest sort but wrong in many locales
--- CANONICAL_DECOMPOSITION includes accents and chars with special formats,
most complete but slowest, default.

> 3. Also, correct me if I'm wrong, the icu4jSortQuery is only meant for sorting
> 1 column?

yup. you're welcome to extend it ;-) hint, have a look at the collateSortID.