lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1447040 - in /lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util: LuceneTestCase.java _TestUtil.java
Date Sun, 17 Feb 2013 16:42:36 GMT
Author: rmuir
Date: Sun Feb 17 16:42:36 2013
New Revision: 1447040

URL: http://svn.apache.org/r1447040
Log:
speed up newSearcher a bit

Modified:
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java?rev=1447040&r1=1447039&r2=1447040&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/LuceneTestCase.java
Sun Feb 17 16:42:36 2013
@@ -1246,8 +1246,10 @@ public abstract class LuceneTestCase ext
       if (maybeWrap) {
         r = maybeWrapReader(r);
       }
-      if (r instanceof AtomicReader) {
-        _TestUtil.checkReader((AtomicReader)r);
+      if (rarely() && r instanceof AtomicReader) {
+        // TODO: not useful to check DirectoryReader (redundant with checkindex)
+        // but maybe sometimes run this on the other crazy readers maybeWrapReader creates?
+        _TestUtil.checkReader(r);
       }
       IndexSearcher ret = random.nextBoolean() ? new AssertingIndexSearcher(random, r) :
new AssertingIndexSearcher(random, r.getContext());
       ret.setSimilarity(classEnvRule.similarity);

Modified: lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java?rev=1447040&r1=1447039&r2=1447040&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
(original)
+++ lucene/dev/trunk/lucene/test-framework/src/java/org/apache/lucene/util/_TestUtil.java
Sun Feb 17 16:42:36 2013
@@ -53,6 +53,7 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.document.NumericDocValuesField;
 import org.apache.lucene.document.SortedDocValuesField;
 import org.apache.lucene.index.AtomicReader;
+import org.apache.lucene.index.AtomicReaderContext;
 import org.apache.lucene.index.CheckIndex;
 import org.apache.lucene.index.CheckIndex.Status.DocValuesStatus;
 import org.apache.lucene.index.CheckIndex.Status.FieldNormStatus;
@@ -228,8 +229,10 @@ public class _TestUtil {
   
   /** This runs the CheckIndex tool on the Reader.  If any
    *  issues are hit, a RuntimeException is thrown */
-  public static void checkReader(AtomicReader reader) throws IOException {
-    checkReader(reader, true);
+  public static void checkReader(IndexReader reader) throws IOException {
+    for (AtomicReaderContext context : reader.leaves()) {
+      checkReader(context.reader(), true);
+    }
   }
   
   public static void checkReader(AtomicReader reader, boolean crossCheckTermVectors) throws
IOException {



Mime
View raw message