mirror of https://github.com/apache/lucene.git
Fixed a NPE in Query.explain().
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150155 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
859e6eee20
commit
321b292be9
|
@ -212,7 +212,10 @@ public class PhrasePrefixQuery extends Query {
|
|||
fieldExpl.addDetail(idfExpl);
|
||||
|
||||
Explanation fieldNormExpl = new Explanation();
|
||||
fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
|
||||
byte[] fieldNorms = reader.norms(field);
|
||||
float fieldNorm =
|
||||
fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
|
||||
fieldNormExpl.setValue(fieldNorm);
|
||||
fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
|
||||
fieldExpl.addDetail(fieldNormExpl);
|
||||
|
||||
|
|
|
@ -210,7 +210,10 @@ public class PhraseQuery extends Query {
|
|||
fieldExpl.addDetail(idfExpl);
|
||||
|
||||
Explanation fieldNormExpl = new Explanation();
|
||||
fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
|
||||
byte[] fieldNorms = reader.norms(field);
|
||||
float fieldNorm =
|
||||
fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
|
||||
fieldNormExpl.setValue(fieldNorm);
|
||||
fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
|
||||
fieldExpl.addDetail(fieldNormExpl);
|
||||
|
||||
|
|
|
@ -139,7 +139,10 @@ public class TermQuery extends Query {
|
|||
fieldExpl.addDetail(idfExpl);
|
||||
|
||||
Explanation fieldNormExpl = new Explanation();
|
||||
fieldNormExpl.setValue(Similarity.decodeNorm(reader.norms(field)[doc]));
|
||||
byte[] fieldNorms = reader.norms(field);
|
||||
float fieldNorm =
|
||||
fieldNorms!=null ? Similarity.decodeNorm(fieldNorms[doc]) : 0.0f;
|
||||
fieldNormExpl.setValue(fieldNorm);
|
||||
fieldNormExpl.setDescription("fieldNorm(field="+field+", doc="+doc+")");
|
||||
fieldExpl.addDetail(fieldNormExpl);
|
||||
|
||||
|
|
Loading…
Reference in New Issue