You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-dev@lucene.apache.org by "Hoss Man (JIRA)" <ji...@apache.org> on 2009/02/19 23:50:01 UTC

[jira] Resolved: (SOLR-1019) ConstantScorePrefixQuery.java - Absolute FP comparison on getBoost()

     [ https://issues.apache.org/jira/browse/SOLR-1019?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hoss Man resolved SOLR-1019.
----------------------------

    Resolution: Invalid

In both the lines you suggest changing, i believe using value equality is actually more correct then an epsilon comparison given the intent of the code.

1) In toString() the intent is to display the boost when it isn't the default (1.0f), an epsilon based comparison could hide the boost value when it varies from the default by an extremely small amount.  It's better to output "^1.000000001" then nothing at all.

2) In the equals method we need to know if the Query objects are ... well, equal.  if the boost values vary by an amount less then the epsilon we would erroneously return true.  (if i'm not mistaken, the equals change you're suggesting would actually break caching in some edge cases, because it would result in situations where...
{code}queryA.equals(queryB) && ! queryA.hashCode()==queryB.hashCode(){code}

> ConstantScorePrefixQuery.java - Absolute FP comparison on getBoost() 
> ---------------------------------------------------------------------
>
>                 Key: SOLR-1019
>                 URL: https://issues.apache.org/jira/browse/SOLR-1019
>             Project: Solr
>          Issue Type: Bug
>          Components: clients - java
>    Affects Versions: 1.3
>         Environment: Java 6, Tomcat 6
>            Reporter: Kay Kay
>         Attachments: SOLR-1019.patch
>
>
> Absolute FP comparisons are inherently unsafe.  Comparisons of FP done under an epsilon resolution difference. 
> affects ConstantScorePrefixQuery#toString() and #equals() 

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