lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <>
Subject ComparatorKey in Locale based sorting?
Date Mon, 21 Aug 2006 17:51:39 GMT

I've never really looked at the javadocs for Collator much before
yesterday, but I just noticed a comment about a class i'd never heard of:
CollationKey ...

> For comparing Strings exactly once, the compare method provides the best
> performance. When sorting a list of Strings however, it is generally
> necessary to compare each String multiple times. In this case,
> CollationKeys provide better performance. The CollationKey class
> converts a String to a series of bits that can be compared bitwise
> against other CollationKeys. A CollationKey is created by a Collator
> object for a given String.

this is exactly what FieldSortedHitQueue does in the ScoreDocComparator
returned by comparatorStringLocale -- and it got me thinking, perhaps it
would be worthwhile for comparatorStringLocale to convert the String[] it
gets back from FieldCache.DEFAULT.getStrings to a new CollationKey[]?

or maybe even for FieldCache.DEFAULT.getStrings to be deprecated, and
replaced with a FieldCache.DEFAULT.getCollationKeys(reader,field,Collator)


To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message