Friday, 8 December 2006

Sorting in databases

Discovered via a circuitous route, Jim Downing notes that Dorothea Salo has a great tip for fixing sort ordering in the DSpace browse. Since I'm working on this feature as we speak, it's important for me to be able to take this on board. In fact, I have the following feature planned:

Allow each field to request a Normaliser for its entry into the sort_value column of the browse system. Using the PluginManager for DSpace, this might look like this:


String myValue = "some value to be normalised";
String myLang = "en"; // this is the language I want to normalise into
Normaliser myNormaliser = (Normaliser) PluginManager.getNamedPlugin(Normaliser.class, myLang);
myValue = myNormaliser.normalise(myValue);


our configuration for this would then probably just be something like the following:


plugin.named.org.dspace.browse.Normaliser = \
org.dspace.browse.EnglishNormaliser = en, \
org.dspace.browse.NorwegianNormaliser = no


and so forth. Then, the way your normaliser works would be up to you, and perhaps for Dorothea's example, you need to just maintain a mapping file of unicode values and their target English representation.

No comments: