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 Alan Woodward <al...@romseysoftware.co.uk> on 2012/02/13 12:39:18 UTC

Overriding SloppySimScorer

Hello,

I want to score span queries based on the simple presence or absence of a hit (I'm not interested in Tf or Idf here), with a possible boost on specific spans.  I've already extended DefaultSimilarity to deal with single terms.  From looking at the code it seems that I want to override TFIDFSimilary#sloppySimScorer to return a custom SloppySimScorer instance.  However, this method has been declared final.  Am I going about this the wrong way?  Or should the SimScorer methods on TDIDFSimilarity be unfinalized?

I'm using Lucene trunk, r1241355.

Thanks,

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


Re: Overriding SloppySimScorer

Posted by Alan Woodward <al...@romseysoftware.co.uk>.
On 13 Feb 2012, at 12:16, Robert Muir wrote:

> On Mon, Feb 13, 2012 at 6:39 AM, Alan Woodward
> <al...@romseysoftware.co.uk> wrote:
>> Hello,
>> 
>> (I'm not interested in Tf or Idf here)
>>  I've already extended DefaultSimilarity
> 
> In this case, then extending DefaultSimilarity/TFIDFSimilarity is not
> the best approach.

Ah yes, the clue's in the name, I suppose.  :-)  I've extended the base Similarity class instead, and that works.

Thanks for your help.

> 
>> Or should the SimScorer methods on TDIDFSimilarity be unfinalized?
> 
> No, it must be final, because TFIDFSimilarity only exposes its
> historical api: tf(), idf(), etc.
> 
>> Am I going about this the wrong way?
> 
> Maybe you should just extend Similarity...
> 
> -- 
> lucidimagination.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 


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


Re: Overriding SloppySimScorer

Posted by Robert Muir <rc...@gmail.com>.
On Mon, Feb 13, 2012 at 6:39 AM, Alan Woodward
<al...@romseysoftware.co.uk> wrote:
> Hello,
>
> (I'm not interested in Tf or Idf here)
> I've already extended DefaultSimilarity

In this case, then extending DefaultSimilarity/TFIDFSimilarity is not
the best approach.

> Or should the SimScorer methods on TDIDFSimilarity be unfinalized?

No, it must be final, because TFIDFSimilarity only exposes its
historical api: tf(), idf(), etc.

> Am I going about this the wrong way?

Maybe you should just extend Similarity...

-- 
lucidimagination.com

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