Doug Cutting writes (3/22/2005 10:05 AM):
Chuck Williams wrote:
If there is going to be any generalization to built-in sorting representations, I'd like to suggest two things be included:
1. Fix issue 34028 (delete the one word "final")
Done.
Thank you!
2. Include a provision for query-time parameters
Can you provide a proposal?
I'd like to think it out further, but one possible improvement that comes to mind immediately is to make FieldSortedHitQueue an inner class of Sort. It is already a function of Sort (specifically, of Sort.fields which is the entire state of Sort). Making it an inner class is therefore natural, and allows users to create specialized Sort's, e.g. with query-time parameters that they can reference in their specialized FieldSortedHitQueues. This would eliminate the need to specialize IndexSearcher.
The other specializations are FieldSortedHitQueue, SortComparatorSource and ScoreDocComparator. ScoredDocCompator implements the semantics; it must be a global class since it stores the arrays of sort-field values, cached with the IndexReader. The issue is passing the query-time parameters to its varous methods, which is done though FieldSortedHitQueue.
It would be nice to go one step further and avoid the need to specialize FieldSortedHitQueue. It seems this could be done if the queue itself, or its Sort container, were passed as parameters to all the methods in ScoreDocComparator, but I have not worked out all the details to fully assess that. If this was done, then the entire specialization would be to create a custom Sort with the addition of arbitrary query-time parameters, and create a custom SortComparatorSource to construct a custom ScoreDocComparator that implements all of the semantics of parsing, caching, comparing, etc., the stored and query-time sort parameters.
That would be elegant.
If this sounds like a good approach, I could put it in my task queue to construct a patch.
Chuck
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]