Normalize for Diacritics in Browse Author to correct sort order

 

I have applied the suggested fix to normalize the sort when browsing authors
as found here:

 

http://www.mail-archive.com/[email protected]/msg00570.html

 

The 'Authors' now sort correctly as a result of this fix however when
clicking on an author with diacritics the documents  submitted by that
author are not displayed.

The diacritic form of the author's name is submitted through the GET METHOD
which packages the information into the URL and calls
ItemsByAuthorServlet.java. By tracing through the code we discovered a
comparison is made to the "sort_author" field in table "itemsbyauthor".
Because we are comparing the diacritic form of the author provided by the
GET METHOD to the normalized author from "sort_author", no documents are
retrieved. Should we not be doing a comparison to the "author" field from
table "itemsbyauthor" which holds the author's name in the diacritic form?

 

For the time being, to make the link to the documents we modified the code
in ItemsByAuthorServlet.java to normalize the author submitted by the GET
METHOD. This creates some extra code which does not seem as clean as
accessing the author field directly.

 

Here is the patch I put together to work around this for the time being:

 

--- ItemsByAuthorServlet.java   (original)

+++ ItemsByAuthorServlet.java   (modified)

@@ -58,6 +58,10 @@

 import org.dspace.core.Context;

 import org.dspace.core.LogManager;

 

+// For normalizing author

+import com.ibm.icu.text.Normalizer;

+

 /**

  * Displays the items with a particular author.

  *

@@ -118,6 +121,10 @@

             author = "";

         }

 

+        // Normalize author

+        author = Normalizer.normalize(author.toLowerCase(), Normalizer.NFD)

+        .replaceAll("\\p{InCombiningDiacriticalMarks}+", "");

+

         // Do the browse

 

 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech

Reply via email to