You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Ryan Aylward <ry...@glassdoor.com> on 2010/12/07 07:09:39 UTC

Help Overriding behavior in BooleanQuery scorer

I would like to customize the scoring of the BooleanQuery. The scoring
for Boolean queries sums together each clause. Rather than summing
together each clause, I would like to take the max score of any of the
clauses.

 

Ideally, I would like to inherit from BooleanScorer and BooleanScorer2
and make a couple of very minor changes to it. Unfortunately, both
classes are package protected and declared as final. This prevents me
from being able to modify them at all. It seems the only way I can
change this is to basically create a copy of a bunch of classes
(BooleanQuery, BooleanWeight, BooleanScorer, BooleanScorer2,
DisjunctionSumScorer, ConjunctionScorer, etc).

 

Does anyone know why many of those classes are package protected and
final? Any suggestions for how to customize this part of the scoring
algorithm without having to copy all of these classes?

 

Thanks,

Ryan Aylward


RE: Help Overriding behavior in BooleanQuery scorer

Posted by Ryan Aylward <ry...@glassdoor.com>.
Thanks very much for the response, Erick.

I think one of my co-workers tried to use it and seemed to think it
didn't meet our needs but I'll give it a shot.

In the meantime, I'm curious to see if anyone else has modified
BooleanQuery to modify how calculates the score. Is the only way to do
that to make a copy of the classes?

-----Original Message-----
From: Erick Erickson [mailto:erickerickson@gmail.com] 
Sent: Tuesday, December 07, 2010 4:57 AM
To: java-user@lucene.apache.org
Subject: Re: Help Overriding behavior in BooleanQuery scorer

I haven't a clue about the package protected thing, but
you may not need to go there. This sounds a lot like
DisjunctionMaxQuery, have you looked at it?
 http://lucene.apache.org/java/3_0_2/api/all/index.html

<http://lucene.apache.org/java/3_0_2/api/all/index.html>Best
Erick

On Tue, Dec 7, 2010 at 1:09 AM, Ryan Aylward <ry...@glassdoor.com> wrote:

> I would like to customize the scoring of the BooleanQuery. The scoring
> for Boolean queries sums together each clause. Rather than summing
> together each clause, I would like to take the max score of any of the
> clauses.
>
>
>
> Ideally, I would like to inherit from BooleanScorer and BooleanScorer2
> and make a couple of very minor changes to it. Unfortunately, both
> classes are package protected and declared as final. This prevents me
> from being able to modify them at all. It seems the only way I can
> change this is to basically create a copy of a bunch of classes
> (BooleanQuery, BooleanWeight, BooleanScorer, BooleanScorer2,
> DisjunctionSumScorer, ConjunctionScorer, etc).
>
>
>
> Does anyone know why many of those classes are package protected and
> final? Any suggestions for how to customize this part of the scoring
> algorithm without having to copy all of these classes?
>
>
>
> Thanks,
>
> Ryan Aylward
>
>

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


Re: Help Overriding behavior in BooleanQuery scorer

Posted by Erick Erickson <er...@gmail.com>.
I haven't a clue about the package protected thing, but
you may not need to go there. This sounds a lot like
DisjunctionMaxQuery, have you looked at it?
 http://lucene.apache.org/java/3_0_2/api/all/index.html

<http://lucene.apache.org/java/3_0_2/api/all/index.html>Best
Erick

On Tue, Dec 7, 2010 at 1:09 AM, Ryan Aylward <ry...@glassdoor.com> wrote:

> I would like to customize the scoring of the BooleanQuery. The scoring
> for Boolean queries sums together each clause. Rather than summing
> together each clause, I would like to take the max score of any of the
> clauses.
>
>
>
> Ideally, I would like to inherit from BooleanScorer and BooleanScorer2
> and make a couple of very minor changes to it. Unfortunately, both
> classes are package protected and declared as final. This prevents me
> from being able to modify them at all. It seems the only way I can
> change this is to basically create a copy of a bunch of classes
> (BooleanQuery, BooleanWeight, BooleanScorer, BooleanScorer2,
> DisjunctionSumScorer, ConjunctionScorer, etc).
>
>
>
> Does anyone know why many of those classes are package protected and
> final? Any suggestions for how to customize this part of the scoring
> algorithm without having to copy all of these classes?
>
>
>
> Thanks,
>
> Ryan Aylward
>
>