You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Joel Bernstein (JIRA)" <ji...@apache.org> on 2014/05/19 16:53:38 UTC
[jira] [Comment Edited] (LUCENE-5682) NPE in QueryRescorer when
Scorer is null
[ https://issues.apache.org/jira/browse/LUCENE-5682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14001734#comment-14001734 ]
Joel Bernstein edited comment on LUCENE-5682 at 5/19/14 2:52 PM:
-----------------------------------------------------------------
Ok, that makes sense attaching new patch with this logic:
{code}
if(scorer != null) {
int targetDoc = docID - docBase;
int actualDoc = scorer.docID();
if (actualDoc < targetDoc) {
actualDoc = scorer.advance(targetDoc);
}
if (actualDoc == targetDoc) {
// Query did match this doc:
hit.score = combine(hit.score, true, scorer.score());
} else {
// Query did not match this doc:
assert actualDoc > targetDoc;
hit.score = combine(hit.score, false, 0.0f);
}
} else {
hit.score = combine(hit.score, false, 0.0f);
}
{code}
was (Author: joel.bernstein):
Ok, that makes sense attaching new patch with this logic:
{code}
if(scorer != null) {
int targetDoc = docID - docBase;
int actualDoc = scorer.docID();
if (actualDoc < targetDoc) {
actualDoc = scorer.advance(targetDoc);
}
if (actualDoc == targetDoc) {
// Query did match this doc:
hit.score = combine(hit.score, true, scorer.score());
} else {
// Query did not match this doc:
assert actualDoc > targetDoc;
hit.score = combine(hit.score, false, 0.0f);
}
} else {
hit.score = combine(hit.score, false, 0.0f);
}
{code}
> NPE in QueryRescorer when Scorer is null
> ----------------------------------------
>
> Key: LUCENE-5682
> URL: https://issues.apache.org/jira/browse/LUCENE-5682
> Project: Lucene - Core
> Issue Type: Bug
> Affects Versions: 4.8
> Reporter: Joel Bernstein
> Assignee: Joel Bernstein
> Attachments: LUCENE-5682.patch
>
>
> While testing out the QueryRescorer I was getting an NPE on the scorer when using a TermQuery as the rescore query. Looks like a TermQuery will return a null Scorer if the term is not present in the index segment.
> Caused by: java.lang.NullPointerException
> [junit4] > at org.apache.lucene.search.QueryRescorer.rescore(QueryRescorer.java:89)
--
This message was sent by Atlassian JIRA
(v6.2#6252)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org