You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Michael Busch (JIRA)" <ji...@apache.org> on 2007/06/01 04:03:15 UTC

[jira] Created: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

DefaultSimilarity.queryNorm() should never return Infinity
----------------------------------------------------------

                 Key: LUCENE-901
                 URL: https://issues.apache.org/jira/browse/LUCENE-901
             Project: Lucene - Java
          Issue Type: Bug
          Components: Search
            Reporter: Michael Busch
            Priority: Trivial


Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.

A simple fix would be to return 1.0f in case zero is passed in.

See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500814 ] 

Yonik Seeley commented on LUCENE-901:
-------------------------------------

> huh? queryNorm is passed down by BooleanWeight to all of the sub clauses ... am i miss understanding something?

Sorry, I meant Similarity.queryNorm() is only called at the top level.

> With nested queries, could Float.MAX_VALUE trigger overflow back to Infinity? 

I don't think so... BooleanWeight multiplies the queryNorm by it's boost before calling normalize on the nested weights (hence if the top-level boost is zero, it will call normalize(0.0f) on the subweights).
SpanWeight doesn't seem to do nested normalization at all.
Not sure if all the explain implementations would handle it correctly though.

> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500782 ] 

Hoss Man commented on LUCENE-901:
---------------------------------

> From a scoring perspective, it's a multiplier that's only used at the top level, so the scores produced will be zero anyway. 

huh?  queryNorm is passed down by BooleanWeight to all of the sub clauses ... am i miss understanding something? 

> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Hoss Man (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500576 ] 

Hoss Man commented on LUCENE-901:
---------------------------------

I'm not sure if i agree with this concept. Do we really want the curve of values from queryNorm to have a step drop down from really *huge* values when sumOfSquaredWeights is "near" zero to "1" when sumOfSquaredWeights becomes so close to zero it can only be represented as 0.0f ?

Float.MAX_VALUE seems like a better choice then 1, but I haven't really thought through wether or not that will still trigger NaN scores.

> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Yonik Seeley (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500722 ] 

Yonik Seeley commented on LUCENE-901:
-------------------------------------

>From a scoring perspective, it's a multiplier that's only used at the top level, so the scores produced will be zero anyway.  How else might Similarity.queryNorm() be used?

If the user uses a boost of zero, It doesn't make sense to try and normalize that upwards though.  Returning 0 could also make sense.



> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Doug Cutting (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500779 ] 

Doug Cutting commented on LUCENE-901:
-------------------------------------

Float.MAX_VALUE seems like a better choice then 1 [ ... ]

With nested queries, could Float.MAX_VALUE trigger overflow back to Infinity?


> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-901) DefaultSimilarity.queryNorm() should never return Infinity

Posted by "Michael Busch (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12500756 ] 

Michael Busch commented on LUCENE-901:
--------------------------------------

> Float.MAX_VALUE seems like a better choice then 1, but I haven't really 
> thought through wether or not that will still trigger NaN scores.

Float.MAX_VALUE * 0.0f = 0.0f. It would not result in NaN.

> DefaultSimilarity.queryNorm() should never return Infinity
> ----------------------------------------------------------
>
>                 Key: LUCENE-901
>                 URL: https://issues.apache.org/jira/browse/LUCENE-901
>             Project: Lucene - Java
>          Issue Type: Bug
>          Components: Search
>            Reporter: Michael Busch
>            Priority: Trivial
>
> Currently DefaultSimilarity.queryNorm() returns Infinity if sumOfSquaredWeights=0.
> This can result in a score of NaN (e. g. in TermScorer) if boost=0.0f.
> A simple fix would be to return 1.0f in case zero is passed in.
> See LUCENE-698 for discussions about this.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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