lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Erik Hatcher <e...@ehatchersolutions.com>
Subject Re: sorting on a non english based locale field
Date Thu, 30 Dec 2004 08:32:18 GMT

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: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Mime
View raw message