From e83d2c63bb1028e05779abe968dd24b8b76de1ee Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Fri, 5 Nov 2010 18:12:09 +0000 Subject: [PATCH] LUCENE-2744: only print number of fields w/ norms on 'test: norms....' CheckIndex output git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1031686 13f79535-47bb-0310-9956-ffa450edef68 --- lucene/CHANGES.txt | 4 ++++ lucene/src/java/org/apache/lucene/index/CheckIndex.java | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt index 4f459c3097c..4ea46fc18b5 100644 --- a/lucene/CHANGES.txt +++ b/lucene/CHANGES.txt @@ -614,6 +614,10 @@ Bug fixes fields could lead to invalid ArrayIndexOutOfBoundsExceptions. (Robert Muir, Mike McCandless) +* LUCENE-2744: CheckIndex was stating total number of fields, + not the number that have norms enabled, on the "test: field + norms..." output. (Mark Kristensson via Mike McCandless) + New features * LUCENE-2128: Parallelized fetching document frequencies during weight diff --git a/lucene/src/java/org/apache/lucene/index/CheckIndex.java b/lucene/src/java/org/apache/lucene/index/CheckIndex.java index 01274beaf34..4656001c120 100644 --- a/lucene/src/java/org/apache/lucene/index/CheckIndex.java +++ b/lucene/src/java/org/apache/lucene/index/CheckIndex.java @@ -550,7 +550,9 @@ public class CheckIndex { } final byte[] b = new byte[reader.maxDoc()]; for (final String fieldName : fieldNames) { - reader.norms(fieldName, b, 0); + if (reader.hasNorms(fieldName)) { + reader.norms(fieldName, b, 0); + } ++status.totFields; }