cancel
Showing results for 
Search instead for 
Did you mean: 

lucene sort problem for non-ascii characters

vycitalr
Champ in-the-making
Champ in-the-making
Hello,
I have problems getting correct sorting by lucene when searching for users and sorting by LASTNAME. The users' names in system use non-ascii characters (Czech ones). In fact its just the standard query in the UIAssociationEditor that does not work. I changed it a litte for my purposes, it gives correct results but badly sorted. All the names beggining with the non-ascii chars are always all at the end of result list. In the query I keep the sorting by LASTNAME with

searchParams.addSort("@" + ContentModel.PROP_LASTNAME, true);

Is the org.alfresco.web.data.Sort related to Lucene searching? I do not think so. I do not whuch way I should examine further.

Thank you for your help.
7 REPLIES 7

vycitalr
Champ in-the-making
Champ in-the-making
I found the cause of the problem. I think it's a general bug there. The ADMLuceneSearcherImpl.query(SearchParameters searchParameters) does not pass the Locale into t the lucene's SortField objects when creating them. So even when you have the Locale set in the search params, it is never used for sorting.

kevinr
Star Contributor
Star Contributor

anna_kane
Champ in-the-making
Champ in-the-making
http://issues.alfresco.com/browse/AR-2024

Is anyone working on this issue? I'm running into this same problem too, and that would be a show-stopper for us. I have been digging around for almost 3 days now…

Thanks a lot.

anna kane

anna_kane
Champ in-the-making
Champ in-the-making
Can someone help with this issue please? I've been struggling for so many days already. I've tried vycitalr's solution without any success.

The only thing we want to achieve is that, when the user opens a space, all items in the space are sorted according to the locale. We have started up Alfresco in the right locale, but the list of items are displayed according to whatever sorting order (which we have no clue). When we have english item names, they are sorted just fine, but not with names in other language.

What else can I do? Someone please give a hint, we will get our hands dirty for that. We just are not familiar with the internals, have no clue where to start.

I guess there's no hope getting any help from this forum… It's amazing that such a basic and important feature is so missing.

struggling anna kane

vycitalr
Champ in-the-making
Champ in-the-making
I thnink your problem is little bit different that the one described in my fix. It might have nothing to do with lucene at all. It depends if spaces are searched for by lucene when browsing them - I rather think they are not. But anyway, I did try your case and I am NOT having the problem - I get spaces sorted well according to locale. So it seems to me rather as a sort of configuration problem. Unfortunately I do not have much time spending on this now, at least I will try to look if we have any other customization that might be related to sorting. At this very instant I think we did modify some basic class about sort or changed some param for it.

vycitalr
Champ in-the-making
Champ in-the-making
Ok, I found we made a little change in org.alfresco.web.data.Sort class. I do not remember what was the primary reason for this, but I suppose some sorting went wrong- so perhpas it could aslo be releated to your problem. Try setting the strongStringCompare to true, it should force using strong collation keys instead of simple string compare - it might do the job.

Try this in org.alfresco.web.data.Sort

   /** config value whether to use strong collation Key string comparisons */
   private boolean strongStringCompare = true;

Also make sure you have set the java properties as to language and country properly for you (-Duser.country and -Duser.language).

Hope this helps.

anna_kane
Champ in-the-making
Champ in-the-making
vycitalr, thank you very much, you are the man. That did the trick!

I can't believe this problem has been left like this, for how long now?