Re: Sorting with diacritics patch

2007-06-15 Thread Tibor Simko
Hello Ferran:

On Mon, 11 Jun 2007, Ferran Jorba wrote:

 please take this fix into consideration.

Committed, thanks!

Best regards
-- 
Tibor Simko ** CERN Document Server ** http://cds.cern.ch/



Sorting with diacritics patch

2007-06-11 Thread Ferran Jorba
Hi all,

please take this fix into consideration.  It fixes this case:

http://ddd.uab.cat/search?ln=enp=Enginyer+Qu%C3%ADmicf=titulacioaction_search=Searchc=sf=titleso=arm=rg=10sc=0of=hb

Now Àlgebra is the first in the list; otherwise, it was the last.  This
patch is against current CVS; in 0.92.1 is around line 2243.

Thanks,

Ferran
This fixes sorting words that have diacritics, specially in the first word
like Agrave;lgebra, because otherwise they appear at the end of the list.

---
 modules/websearch/lib/search_engine.py |2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

Index: cds-invenio/modules/websearch/lib/search_engine.py
===
--- cds-invenio.orig/modules/websearch/lib/search_engine.py	2007-06-11 12:52:08.352732646 +0200
+++ cds-invenio/modules/websearch/lib/search_engine.py	2007-06-11 12:58:37.810073415 +0200
@@ -2415,7 +2415,7 @@
 else:
 # no sort pattern defined, so join them all together
 val = string.join(vals)
-val = val.lower()
+val = strip_accents(val.lower())
 if recIDs_dict.has_key(val):
 recIDs_dict[val].append(recID)
 else: