On Wednesday 24 November 2004 01:31, Ken McCracken wrote: > Hi, > > Thanks the pointers in your replies. Would it be possible to include > some sort of accrual scorer interface somewhere in the Lucene Query > APIs? This could be passed into a query similar to > MaxDisjunctionQuery; and combine the sum, max, tieBreaker, etc., > according to the implementor's discretion, to compute the overall > score for a document.
The DisjunctionScorer is currently not part of Lucene. You might try and subclass Similarity to provide what you need and pass that to your Query. I'm using a few subclasses of DisjunctionScorer to provide the actual score value ao. for max and sum. For each of these scorers, I use a separate Query and Weight. This gives a parallel class hierarchy for Query, Weight and Scorer. I guess it's time to have a look at Design Patterns and/or Refactoring on how to get rid of the parallel class hierarchy. That could also involve some sort of accrual scorer and Lucene's Similarity. Regards, Paul Elschot > -Ken > > On Sat, 13 Nov 2004 12:07:05 +0100, Paul Elschot <[EMAIL PROTECTED]> wrote: > > On Friday 12 November 2004 22:56, Chuck Williams wrote: > > > > > > > I had a similar need and wrote MaxDisjunctionQuery and > > > MaxDisjunctionScorer. Unfortunately these are not available as a patch > > > but I've included the original message below that has the code (modulo > > > line breaks added by simple text email format). > > > > > > This code is functional -- I use it in my app. It is optimized for its > > > stated use, which involves a small number of clauses. You'd want to > > > improve the incremental sorting (e.g., using the bucket technique of > > > BooleanQuery) if you need it for large numbers of clauses. > > > > When you're interested, you can also have a look here for > > yet another DisjunctionScorer: > > http://issues.apache.org/bugzilla/show_bug.cgi?id=31785 > > > > It has the advantage that it implements skipTo() so that it can > > be used as a subscorer of ConjunctionScorer, ie. it can be > > faster in situations like this: > > > > aa AND (bb OR cc) > > > > where bb and cc are treated by the DisjunctionScorer. > > When aa is a filter this can also be used to implement > > a filtering query. > > > > > > > > > > > Re. Paul's suggested steps below, I did not integrate this with query > > > parser as I didn't need that functionality (since I'm generating the > > > multi-field expansions for which max is a much better scoring choice > > > than sum). > > > > > > Chuck > > > > > > Included message: > > > > > > -----Original Message----- > > > From: Chuck Williams [mailto:[EMAIL PROTECTED] > > > Sent: Monday, October 11, 2004 9:55 PM > > > To: [EMAIL PROTECTED] > > > Subject: Contribution: better multi-field searching > > > > > > The files included below (MaxDisjunctionQuery.java and > > > MaxDisjunctionScorer.java) provide a new mechanism for searching across > > > multiple fields. > > > > The maximum indeed works well, also when the fields differ a lot length. > > > > Regards, > > Paul > > > > > > > > > > --------------------------------------------------------------------- > > 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] > > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]