lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r734974 - /lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
Date Fri, 16 Jan 2009 11:11:25 GMT
Author: mikemccand
Date: Fri Jan 16 03:11:24 2009
New Revision: 734974

URL: http://svn.apache.org/viewvc?rev=734974&view=rev
Log:
LUCENE-1520: re-use single byte[] for all fields when testing norms

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java?rev=734974&r1=734973&r2=734974&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/CheckIndex.java Fri Jan 16 03:11:24
2009
@@ -407,18 +407,17 @@
           }
           msg("OK");
         }
+        if (reader.maxDoc() != info.docCount)
+          throw new RuntimeException("SegmentReader.maxDoc() " + reader.maxDoc() + " != SegmentInfos.docCount
" + info.docCount);
 
         if (infoStream != null)
           infoStream.print("    test: fields, norms.......");
         Collection fieldNames = reader.getFieldNames(IndexReader.FieldOption.ALL);
         Iterator it = fieldNames.iterator();
+        final byte[] b = new byte[reader.maxDoc()];
         while(it.hasNext()) {
           final String fieldName = (String) it.next();
-          final byte[] b = new byte[reader.maxDoc()];
           reader.norms(fieldName, b, 0);
-          if (b.length != info.docCount)
-            throw new RuntimeException("norms for field \"" + fieldName + "\" is length "
+ b.length + " != maxDoc " + info.docCount);
-
         }
         msg("OK [" + fieldNames.size() + " fields]");
         segInfoStat.numFields = fieldNames.size();



Mime
View raw message