: But how can you use both the MissingStringLastComparatorSource and also your : own custom SortComparator (i.e. having a custom getComparable() method)? : : I have tried the obvious, which was to make my custom SortComparator extend : MissingStringLastComparatorSource instead of SortComparator. But then it : seems that my custom getComparable() method is ignored. The sorting
well, yes that's true. getComparable is an abstract method in SortComparator so that subclasses of SortComparator can efinte how the newComparator method will behave ... if you don't subcalss SortComparator getComparable has no meaning. (SortComparator is an instance of SortComparatorSource, but that doesn't mean all other instances of SortComparatorSource -- like MissingStringLastComparatorSource -- have any notion of APIs introduced in SortComparator) It didn't occur to me beofre that you were writing a custom SortComparator ... skimming the code for SortComparator and FieldCache briefly there seems to be a limitation/feature (depending on how you look at it) such that getComparable(null) is never called to decide what do do with the null values -- it just assumes you want a null Comparable as well. : FYI, my end goal is to be able to sort on a field called "AssetType". Some : of the docs in the index may be missing this field (and I'd like those docs : to be sorted at the end of the results). Furthermore, I need a custom : sorting order on the values in this "AssetType" field (first videos, then : articles, then images, etc.). Frankly, My advice to you is to "encode" the AssetType field into some new "SortableAssetType" field when you index your docs -- the code to do that is not only easier to udnerstand then writiting a custom SortComparator or SortComparatorSource but it's also going to be a lot faster ... you do a little more work when indexing, and you make searching/sortign a lot more efficient. -Hoss --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]