lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Robert Muir (JIRA)" <j...@apache.org>
Subject [jira] [Resolved] (LUCENE-8024) Remove unnecessary norms.advanceExact check in score()
Date Tue, 31 Oct 2017 23:50:01 GMT

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

Robert Muir resolved LUCENE-8024.
---------------------------------
       Resolution: Fixed
    Fix Version/s: master (8.0)

> Remove unnecessary norms.advanceExact check in score()
> ------------------------------------------------------
>
>                 Key: LUCENE-8024
>                 URL: https://issues.apache.org/jira/browse/LUCENE-8024
>             Project: Lucene - Core
>          Issue Type: Bug
>            Reporter: Robert Muir
>             Fix For: master (8.0)
>
>         Attachments: LUCENE-8024.patch
>
>
> This should no longer be needed, since the index-time boost is removed, and since sims
are no longer asked to score non-existent terms.
> E.g. core tests pass with:
> {noformat}
> --- a/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java
> +++ b/lucene/core/src/java/org/apache/lucene/search/similarities/BM25Similarity.java
> @@ -230,11 +230,8 @@ public class BM25Similarity extends Similarity {
>        if (norms == null) {
>          norm = k1;
>        } else {
> -        if (norms.advanceExact(doc)) {
> -          norm = cache[((byte) norms.longValue()) & 0xFF];
> -        } else {
> -          norm = cache[0];
> -        }
> +        norms.advanceExact(doc);
> +        norm = cache[((byte) norms.longValue()) & 0xFF];
>        }
>        return weightValue * (float) (freq / (freq + norm));
>      }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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


Mime
View raw message