[ https://issues.apache.org/jira/browse/LUCENE-8024?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16226059#comment-16226059 ]
Robert Muir edited comment on LUCENE-8024 at 10/31/17 12:42 AM: ---------------------------------------------------------------- It looks dumb to fix this but its hard to reason about 3 cases when only 2 really exist (norms are omitted or you have a value >= 1 for the doc). This can make it more clear there isn't divide by zero issues and other problems related to the norm. Zero length is an impossible value, its either missing (which you can detect up-front for the entire segment), or its a positive value. was (Author: rcmuir): It looks dumb to fix this but its hard to reason about 3 cases when only 2 really exist (norms are omitted or you have a value > 1 for the doc). This can make it more clear there isn't divide by zero issues and other problems related to the norm. Zero length is an impossible value, its either missing (which you can detect up-front for the entire segment), or its a positive value. > 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 > > 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-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org