[
https://issues.apache.org/jira/browse/LUCENE-8024?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Robert Muir updated LUCENE-8024:
--------------------------------
Attachment: LUCENE-8024.patch
Patching changing these cases to:
{code}
boolean found = norms.advanceExact(doc);
assert found;
norm = doSomethingWith(norms.longValue());
{code}
> 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
> 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: [email protected]
For additional commands, e-mail: [email protected]