Re: [HELP] Strange sort order. Why?

Ruslan Zasukhin <[email protected]> Tue, 22 Feb 2005 00:51:02 +0200
Newsgroups gmane.comp.lib.icu.general
Message-ID <BE403276.2A159%[email protected]>
On 2/22/05 12:11 AM, "Vladimir Weinstein" <[email protected]> wrote:

You mean that I should build own collation rule ???
But I afraid problem not only in  "a á"
So this looks to be not easy task....

As far as I see now, fundamental problem is ICU compare using
     Unicode Collation Algorithm, which is a multi-level  sort
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This is unusual. This break all my search algorithms which I have use for
years. Let me explain. We develop database and we build index of words.

All my life we have build index which looks as

        allocate
        anything

        big
        bravo
        brother

        close
        create
        cross

So if now I do search:

    WHERE fld >= 'bi' and fld <= 'cr'

Then it was simple as find start of range "big",
And end of range "create".
After this EACH string inside of range was considered as result.

--------------------------------------
What we see now?!

            Sadler Sánchez Saunder

Find WHERE START WITH "Sa".     => Sadler Sánchez Saunder
User say: wrong (!!!)  a <> á


Again, fundamental problem IMHO, that all my life we have write algorithms
which did compare strings LETER BY LETER. In this way did work old good
strcmp().

Now unicode offer us to compare the whole strings for primary base of chars.
And only if they are equal consider accents.... Wow.
I am in the deep shock :-(

FUNDAMENTAL PROBLEM is that this breaks  a < b < c
            



> Yes, if you make a tailoring that establishes a-accent as a primary difference
> from a. There are languages where this is the case (Croatian/Serbian(Latin),
> Slovak etc.). But for English, accented a is just an a with an accent.
> 
> so your tailoring might look something like:
> &a < á
> 
> Hope this helps.
> 
> Regards,
> v.
> 
> Ruslan Zasukhin wrote:
>> On 2/21/05 11:29 PM, "Vladimir Weinstein" <[email protected]> wrote:
>> 
>> Hi Vladimir,
>> 
>> Then I ask in other way. Can I get THIS ORDER using ICU ?
>> 
>>         Sadler  Saunder  Sánchez            (1)
>> 
>> I need this order, because I use this sorted list for range search.
>> I need find all strings that START WITH 'Sa'.
>> 
>> Having order 
>> 
>>         Sadler Sánchez Saunder              (2)
>> 
>> I get incorrect results. Because I find left point of range "Sadler"
>> Then I find right point of range "Saunder"...
>> And into result I get all 3 words including "Sánchez"
>> 
>> But users say: 
>>     Hey, I have choose SECONDARY option.
>>     I do not want to see accents in the result!
>> 
>> So how to get order (1) ?

-- 
Best regards,
Ruslan Zasukhin      [ I feel the need...the need for speed ]
-------------------------------------------------------------
e-mail: [email protected]
web: http://www.paradigmasoft.com

To subscribe to the Valentina mail list go to:
http://lists.macserve.net/mailman/listinfo/valentina
-------------------------------------------------------------