diff --git a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java index d5b799f0a5f..63ba2c563e3 100644 --- a/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java +++ b/lucene/core/src/java/org/apache/lucene/index/FieldInfo.java @@ -210,6 +210,7 @@ public final class FieldInfo { assert checkConsistency(); } + // nocommit type is always number? should we remove this? void setNormValueType(DocValuesType type) { normType = type; assert checkConsistency(); diff --git a/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java b/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java index 55aa7d11d91..ee410861698 100644 --- a/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java +++ b/lucene/core/src/java/org/apache/lucene/index/NormsConsumerPerField.java @@ -43,6 +43,7 @@ final class NormsConsumerPerField extends InvertedDocEndConsumerPerField impleme void finish() throws IOException { if (fieldInfo.isIndexed() && !fieldInfo.omitsNorms()) { if (consumer == null) { + fieldInfo.setNormValueType(FieldInfo.DocValuesType.NUMERIC); consumer = new NumberDVWriter(fieldInfo, docState.docWriter.bytesUsed); } consumer.addValue(docState.docID, similarity.computeNorm(fieldState)); diff --git a/lucene/core/src/test/org/apache/lucene/index/TestUniqueTermCount.java b/lucene/core/src/test/org/apache/lucene/index/TestUniqueTermCount.java index cd7e45cbc71..172f5eca24d 100644 --- a/lucene/core/src/test/org/apache/lucene/index/TestUniqueTermCount.java +++ b/lucene/core/src/test/org/apache/lucene/index/TestUniqueTermCount.java @@ -70,6 +70,7 @@ public class TestUniqueTermCount extends LuceneTestCase { public void test() throws Exception { NumericDocValues fooNorms = MultiSimpleDocValues.simpleNormValues(reader, "foo"); + assertNotNull(fooNorms); for (int i = 0; i < reader.maxDoc(); i++) { assertEquals(expected.get(i).longValue(), fooNorms.get(i)); }