On Dec 29, 2004, at 12:36 PM, Praveen Peddi wrote:
Hi fellow luceners,
I was looking at the lucene sorting code and it looks like lucene does consider locale into account while sorting. So I assume lucene already handles for strings.


But in my case, I wrote my own SortComparator (StringIgnoreCaseSortComparator) to achieve sorting similar to explorer sorting. Because lucene uses java's string.compareTo method and that considers "case" of each character, I can't use lucene's default string sorting.

The question is, how do I integrate Locale into my StringIgnoreCaseSortComparator while comparing strings. Lucene's code gets the locale from SortField but I don't have access to SortField in this comparator.

Any ideas???? Should StringIgnoreCaseSortComparator be just knowing the locale at the time of instantiating?

Yes, when using a custom sorting implementation, you need to hand it whatever information it needs to do the sorting. The Locale parameters to SortField are used only in the built-in mechanisms and not part of the API for using a custom implementation.


        Erik


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to