Tim Jones wrote:
What do you guys think of these two ideas - would they be good additions to the API (or maybe the sandbox)?
1. New type of SortField, allowing custom comparison function:
public SortField (String field, // which field to sort SortComparatorFactory comparator, // how to sort boolean reverse) // whether to reverse
// returns a comparator for the given IndexReader and field public interface SortComparatorFactory { ScoreDocLookupComparator comparator (IndexReader reader, String fieldname) }
The thinking behind this idea is it would allow a user of the API to make up any type of Document comparison function they want - the ultimate "slice and dice" (thanks to Erik :) result sorter. It would involve a few very minor changes to the existing Sort api, such as changing ScoreDocComparator.sortValue() to return a Comparable instead of just an Object; making ScoreDocComparator and ScoreDocLookupComparator public instead of package private.
2. New query type: FilteredQuery
public class FilteredQuery (Query query, Filter filter)
The thinking behind this idea is it would allow an individual query to be filtered, instead of just the whole search. Probably not that common, but I wrote it recently to handle a query like:
QueryX OR (QueryY filtered by FilterA)
Thanks,
Tim
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]