lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Hostetter <hossman_luc...@fucit.org>
Subject Re: Custom Sorting Based on Input Value
Date Wed, 15 Oct 2008 03:36:03 GMT

: 3> maybe you could provide a custom sorter by using
: SortComparator, although you should look at the warnings
: in the API.
: 
: Now I'll wait for Hoss to say "Isn't that what XXX provides" <G>...

I can't think of anything that would solve this problem direclty, mianly 
because i can't think of any practical use for a requirement like this, 
but one way it should be possible to solve this while avoiding the 
pitfalls people run into when subclassing SortComparator would be to avoid 
SortComparator (and it's use of FieldCache.DEFAULT.getCustom) and 
implement SortComparatorSource directly ... you don't need to *cache* a 
big array of true/false booleans for when the value does or doesnt' equal 
your magic input, can use FieldCache.DEFAULT.getInt or 
FieldCache.DEFAULT.getStrings, or whatever you need directly (just like a 
normal sort) but let the compare and sortValue short circut if the value 
isn't what it needs to be.



-Hoss


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message