lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r927228 - in /lucene/java/branches/flex_1458: backwards/src/test/org/apache/lucene/index/ contrib/misc/src/java/org/apache/lucene/index/ src/java/org/apache/lucene/analysis/tokenattributes/ src/java/org/apache/lucene/index/ src/java/org/apa...
Date Wed, 24 Mar 2010 23:35:52 GMT
Author: mikemccand
Date: Wed Mar 24 23:35:52 2010
New Revision: 927228

URL: http://svn.apache.org/viewvc?rev=927228&view=rev
Log:
LUCENE-2111: remove remaining non-debugging nocommits

Modified:
    lucene/java/branches/flex_1458/backwards/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/AllDocsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingPostingsReaderImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReaderImpl.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermScorer.java
    lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java
    lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java

Modified: lucene/java/branches/flex_1458/backwards/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/backwards/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/backwards/src/test/org/apache/lucene/index/TestIndexWriter.java
(original)
+++ lucene/java/branches/flex_1458/backwards/src/test/org/apache/lucene/index/TestIndexWriter.java
Wed Mar 24 23:35:52 2010
@@ -4338,12 +4338,6 @@ public class TestIndexWriter extends Luc
 
       assertTrue(dir.fileExists("myrandomfile"));
 
-      // Make sure this does not copy myrandomfile:
-      // nocommit -- Directory.copy now copies all files --
-      // how to fix?
-      //Directory dir2 = new RAMDirectory(dir);
-      //assertTrue(!dir2.fileExists("myrandomfile"));
-
     } finally {
       dir.close();
       _TestUtil.rmDir(indexDir);

Modified: lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java
(original)
+++ lucene/java/branches/flex_1458/contrib/misc/src/java/org/apache/lucene/index/MultiPassIndexSplitter.java
Wed Mar 24 23:35:52 2010
@@ -173,7 +173,7 @@ public class MultiPassIndexSplitter {
    * list of deletions.
    */
   public static class FakeDeleteIndexReader extends FilterIndexReader {
-    // nocommit -- implement flex api here
+    // TODO: switch to flex api, here
 
     OpenBitSet dels;
     OpenBitSet oldDels = null;
@@ -205,7 +205,6 @@ public class MultiPassIndexSplitter {
       if (oldDels != null) {
         dels.or(oldDels);
       }
-      // nocommit -- not good that this class has to do this...
       storeDelDocs(null);
     }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/analysis/tokenattributes/CharTermAttributeImpl.java
Wed Mar 24 23:35:52 2010
@@ -136,7 +136,7 @@ public class CharTermAttributeImpl exten
   
   // *** TermToBytesRefAttribute interface ***
   public int toBytesRef(BytesRef target) {
-    // nocommit: Maybe assume that bytes is already initialized? TermsHashPerField ensures
this.
+    // TODO: Maybe require that bytes is already initialized? TermsHashPerField ensures this.
     if (target.bytes == null) {
       target.bytes = new byte[termLength * 4];
     }
@@ -238,7 +238,6 @@ public class CharTermAttributeImpl exten
 
   @Override
   public String toString() {
-    // nocommit: CharSequence requires that only the contents are returned, but this is orginal
code: "term=" + new String(termBuffer, 0, termLength)
     return new String(termBuffer, 0, termLength);
   }
   

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/AllDocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/AllDocsEnum.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/AllDocsEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/AllDocsEnum.java Wed Mar
24 23:35:52 2010
@@ -48,8 +48,7 @@ class AllDocsEnum extends DocsEnum {
   }
 
   @Override
-  public BulkReadResult read() throws IOException {
-    initBulkResult();
+  public int read() throws IOException {
     final int[] docs = bulkResult.docs.ints;
     final int[] freqs = bulkResult.freqs.ints;
     int i = 0;
@@ -61,8 +60,7 @@ class AllDocsEnum extends DocsEnum {
       }
       doc++;
     }
-    bulkResult.count = i;
-    return bulkResult;
+    return i;
   }
 
   @Override

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/DocsEnum.java Wed Mar
24 23:35:52 2010
@@ -51,7 +51,6 @@ public abstract class DocsEnum extends D
   public static class BulkReadResult {
     public final IntsRef docs = new IntsRef();
     public final IntsRef freqs = new IntsRef();
-    public int count;
   }
 
   protected BulkReadResult bulkResult;
@@ -63,21 +62,22 @@ public abstract class DocsEnum extends D
       bulkResult.freqs.ints = new int[64];
     }
   }
+
+  public BulkReadResult getBulkResult() {
+    initBulkResult();
+    return bulkResult;
+  }
   
   /** Bulk read (docs and freqs).  After this is called,
-   * {@link #doc} and {@link #freq} are undefined.  You must
-   * refer to the count member of BulkResult to determine
-   * how many docs were loaded (the IntsRef for docs and
-   * freqs will not have their length set).  This method
-   * will not return null.  The end has been reached when
-   * .count is 0.
+   * {@link #doc} and {@link #freq} are undefined.  This
+   * returns the count read, or 0 if the end is reached.
+   * The IntsRef for docs and freqs will not have their
+   * length set.
    * 
    *  <p>NOTE: the default impl simply delegates to {@link
    *  #nextDoc}, but subclasses may do this more
    *  efficiently. */
-  // nocommit -- maybe pre-share the BulkReadResult.... hmm
-  public BulkReadResult read() throws IOException {
-    initBulkResult();
+  public int read() throws IOException {
     int count = 0;
     final int[] docs = bulkResult.docs.ints;
     final int[] freqs = bulkResult.freqs.ints;
@@ -91,7 +91,6 @@ public abstract class DocsEnum extends D
         break;
       }
     }
-    bulkResult.count = count;
-    return bulkResult;
+    return count;
   }
 }

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/SegmentReader.java Wed
Mar 24 23:35:52 2010
@@ -1514,6 +1514,7 @@ public class SegmentReader extends Index
       if (terms.seek(new BytesRef(term.text)) == TermsEnum.SeekStatus.FOUND) {
         // Term exists
         any = true;
+        pendingBulkResult = null;
         docsEnum = terms.docs(deletedDocs, docsEnum);
         if (Codec.DEBUG) {
           System.out.println("  init docs enum");
@@ -1534,13 +1535,17 @@ public class SegmentReader extends Index
     }
 
     private DocsEnum.BulkReadResult pendingBulkResult;
+    private int bulkCount;
     private int pendingBulk;
 
     public int read(int[] docs, int[] freqs) throws IOException {
+      if (any && pendingBulkResult == null) {
+        pendingBulkResult = docsEnum.getBulkResult();
+      }
       if (!any) {
         return 0;
       } else if (pendingBulk > 0) {
-        final int left = pendingBulkResult.count - pendingBulk;
+        final int left = bulkCount - pendingBulk;
         if (docs.length >= left) {
           // read all pending
           System.arraycopy(pendingBulkResult.docs.ints, pendingBulk, docs, 0, left);
@@ -1556,11 +1561,11 @@ public class SegmentReader extends Index
         }
       } else {
         // nothing pending
-        pendingBulkResult = docsEnum.read();
-        if (docs.length >= pendingBulkResult.count) {
-          System.arraycopy(pendingBulkResult.docs.ints, 0, docs, 0, pendingBulkResult.count);
-          System.arraycopy(pendingBulkResult.freqs.ints, 0, freqs, 0, pendingBulkResult.count);
-          return pendingBulkResult.count;
+        bulkCount = docsEnum.read();
+        if (docs.length >= bulkCount) {
+          System.arraycopy(pendingBulkResult.docs.ints, 0, docs, 0, bulkCount);
+          System.arraycopy(pendingBulkResult.freqs.ints, 0, freqs, 0, bulkCount);
+          return bulkCount;
         } else {
           System.arraycopy(pendingBulkResult.docs.ints, 0, docs, 0, docs.length);
           System.arraycopy(pendingBulkResult.freqs.ints, 0, freqs, 0, docs.length);

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/intblock/FixedIntBlockIndexInput.java
Wed Mar 24 23:35:52 2010
@@ -49,7 +49,7 @@ public abstract class FixedIntBlockIndex
   public Reader reader() throws IOException {
     final int[] buffer = new int[blockSize];
     final IndexInput clone = (IndexInput) in.clone();
-    // nocommit -- awkward
+    // TODO: can this be simplified?
     return new Reader(clone, buffer, this.getBlockReader(clone, buffer));
   }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
Wed Mar 24 23:35:52 2010
@@ -417,14 +417,13 @@ public class PreFlexFields extends Field
     }
 
     @Override
-    public BulkReadResult read() throws IOException {
+    public int read() throws IOException {
       if (bulkResult == null) {
         initBulkResult();
         bulkResult.docs.ints = new int[32];
         bulkResult.freqs.ints = new int[32];
       }
-      bulkResult.count = this.docs.read(bulkResult.docs.ints, bulkResult.freqs.ints);
-      return bulkResult;
+      return this.docs.read(bulkResult.docs.ints, bulkResult.freqs.ints);
     }
   }
 

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingPostingsReaderImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingPostingsReaderImpl.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingPostingsReaderImpl.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/pulsing/PulsingPostingsReaderImpl.java
Wed Mar 24 23:35:52 2010
@@ -270,7 +270,7 @@ public class PulsingPostingsReaderImpl e
     }
 
     @Override
-    public BulkReadResult read() {
+    public int read() {
       int i=0;
       // TODO: -- ob1?
       initBulkResult();
@@ -284,8 +284,7 @@ public class PulsingPostingsReaderImpl e
           i++;
         }
       }
-      bulkResult.count = i;
-      return bulkResult;
+      return i;
     }
 
     @Override

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/sep/SepPostingsReaderImpl.java
Wed Mar 24 23:35:52 2010
@@ -361,9 +361,8 @@ public class SepPostingsReaderImpl exten
     }
 
     @Override
-    public BulkReadResult read() throws IOException {
+    public int read() throws IOException {
       // TODO: -- switch to bulk read api in IntIndexInput
-      initBulkResult();
       final int[] docs = bulkResult.docs.ints;
       final int[] freqs = bulkResult.freqs.ints;
       int i = 0;
@@ -382,8 +381,7 @@ public class SepPostingsReaderImpl exten
           i++;
         }
       }
-      bulkResult.count = i;
-      return bulkResult;
+      return i;
     }
 
     @Override

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardCodec.java
Wed Mar 24 23:35:52 2010
@@ -41,8 +41,10 @@ public class StandardCodec extends Codec
   public FieldsConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
     StandardPostingsWriter docs = new StandardPostingsWriterImpl(state);
 
-    // nocommit -- how to gracefully upgrade to a new terms
-    // index impl?  could just make a new named codec...
+    // TODO: should we make the terms index more easily
+    // pluggable?  Ie so that this codec would record which
+    // index impl was used, and switch on loading?
+    // Or... you must make a new Codec for this?
     StandardTermsIndexWriter indexWriter;
     boolean success = false;
     try {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReaderImpl.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReaderImpl.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReaderImpl.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/index/codecs/standard/StandardPostingsReaderImpl.java
Wed Mar 24 23:35:52 2010
@@ -281,11 +281,10 @@ public class StandardPostingsReaderImpl 
     }
 
     @Override
-    public BulkReadResult read() throws IOException {
+    public int read() throws IOException {
       if (Codec.DEBUG) {
         Codec.debug("sdr.bulk read: ord=" + ord + " df=" + limit + " omitTF=" + omitTF +
" ord=" + ord + " of " + limit + " freq.fp=" + freqIn.getFilePointer(), desc);
       }
-      initBulkResult();
       final int[] docs = bulkResult.docs.ints;
       final int[] freqs = bulkResult.freqs.ints;
       int i = 0;
@@ -319,8 +318,7 @@ public class StandardPostingsReaderImpl 
         System.out.println("  return " + i);
       }
 
-      bulkResult.count = i;
-      return bulkResult;
+      return i;
     }
 
     @Override

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
(original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/MultiTermQueryWrapperFilter.java
Wed Mar 24 23:35:52 2010
@@ -139,11 +139,12 @@ public class MultiTermQueryWrapperFilter
           // System.out.println("  iter termCount=" + termCount + " term=" +
           // enumerator.term().toBytesString());
           docsEnum = termsEnum.docs(delDocs, docsEnum);
+          final DocsEnum.BulkReadResult result = docsEnum.getBulkResult();
           while (true) {
-            final DocsEnum.BulkReadResult result = docsEnum.read();
-            if (result.count != 0) {
+            final int count = docsEnum.read();
+            if (count != 0) {
               final int[] docs = result.docs.ints;
-              for (int i = 0; i < result.count; i++) {
+              for (int i = 0; i < count; i++) {
                 bitSet.set(docs[i]);
               }
             } else {

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermScorer.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermScorer.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermScorer.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/search/TermScorer.java Wed Mar
24 23:35:52 2010
@@ -38,6 +38,7 @@ final class TermScorer extends Scorer {
   private float[] scoreCache = new float[SCORE_CACHE_SIZE];
   private int[] docs;
   private int[] freqs;
+  private final DocsEnum.BulkReadResult bulkResult;
 
   /**
    * Construct a <code>TermScorer</code>.
@@ -59,6 +60,7 @@ final class TermScorer extends Scorer {
     this.docsEnum = td;
     this.norms = norms;
     this.weightValue = weight.getValue();
+    bulkResult = td.getBulkResult();
 
     for (int i = 0; i < SCORE_CACHE_SIZE; i++)
       scoreCache[i] = getSimilarity().tf(i) * weightValue;
@@ -70,10 +72,9 @@ final class TermScorer extends Scorer {
   }
 
   private final void refillBuffer() throws IOException {
-    final DocsEnum.BulkReadResult result = docsEnum.read();  // refill
-    pointerMax = result.count;
-    docs = result.docs.ints;
-    freqs = result.freqs.ints;
+    pointerMax = docsEnum.read();  // refill
+    docs = bulkResult.docs.ints;
+    freqs = bulkResult.freqs.ints;
   }
 
   // firstDocID is ignored since nextDoc() sets 'doc'

Modified: lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java (original)
+++ lucene/java/branches/flex_1458/src/java/org/apache/lucene/util/BytesRef.java Wed Mar 24
23:35:52 2010
@@ -69,9 +69,10 @@ public final class BytesRef {
    * unpaired surrogates or invalid UTF16 code units.
    */
   public void copy(CharSequence text) {
-    // nocommit -- new byte[10] is waste of resources,
-    // it should simply allocate text.length()*4 like UnicodeUtil.
-    // Ideally, I would remove this here and add a null-check in UnicodeUtil. (Uwe)
+    // TODO: new byte[10] is waste of resources; it should
+    // simply allocate text.length()*4 like UnicodeUtil.
+    // Ideally, I would remove this here and add a
+    // null-check in UnicodeUtil. (Uwe)
     if (bytes == null) {
       bytes = new byte[10];
     }

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/TestExternalCodecs.java Wed
Mar 24 23:35:52 2010
@@ -478,9 +478,9 @@ public class TestExternalCodecs extends 
    *  You must ensure every field you index has a Codec, or
    *  the defaultCodec is non null.  Also, the separate
    *  codecs cannot conflict on file names.*/
-  // nocommit -- promote to core
+  // TODO: promote to core
   public static class PerFieldCodecWrapper extends Codec {
-    private final Map<String,Codec> fields = new HashMap<String,Codec>();
+    private final Map<String,Codec> fields = new IdentityHashMap<String,Codec>();
     private final Codec defaultCodec;
 
     public PerFieldCodecWrapper(Codec defaultCodec) {

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java (original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/FlexTestUtil.java Wed
Mar 24 23:35:52 2010
@@ -264,35 +264,38 @@ public class FlexTestUtil {
               if (rand.nextBoolean()) {
                 // use bulk read API
                 termDocs.seek(t);
-                DocsEnum.BulkReadResult result1 = null;
+                DocsEnum.BulkReadResult result1 = docs.getBulkResult();
+                int result1Count = 0;
                 int count2 = 0;
                 while(true) {
-                  if (result1 == null || result1.count == 0) {
-                    result1 = docs.read();
+                  if (result1Count == 0) {
+                    result1Count = docs.read();
                   }
                   if (count2 == 0) {
                     count2 = termDocs.read(docs2, freqs2);
                   }
 
-                  if (result1.count == 0 || count2 == 0) {
+                  if (result1Count == 0 || count2 == 0) {
                     assertEquals(0, count2);
-                    assertEquals(0, result1.count);
+                    assertEquals(0, result1Count);
                     break;
                   }
-                  final int limit = Math.min(result1.count, count2);
+                  final int limit = Math.min(result1Count, count2);
                   for(int i=0;i<limit;i++) {
                     assertEquals(result1.docs.ints[i], docs2[i]);
                     assertEquals(result1.freqs.ints[i], freqs2[i]);
                   }
-                  if (result1.count > limit) {
+                  if (result1Count > limit) {
                     // copy down
-                    // nocommit -- hmm in general I should
-                    // not muck w/ the int[]'s returned to
-                    // me like this...?
-                    System.arraycopy(result1.docs.ints, limit, result1.docs.ints, 0, result1.count-limit);
-                    System.arraycopy(result1.freqs.ints, limit, result1.freqs.ints, 0, result1.count-limit);
+                    // TODO: in general I should not muck w/
+                    // the int[]'s returned to me like
+                    // this... this could mess up codecs
+                    // that have persistent RAM storage of
+                    // these int[]'s
+                    System.arraycopy(result1.docs.ints, limit, result1.docs.ints, 0, result1Count-limit);
+                    System.arraycopy(result1.freqs.ints, limit, result1.freqs.ints, 0, result1Count-limit);
                   }
-                  result1.count -= limit;
+                  result1Count -= limit;
 
                   if (count2 > limit) {
                     // copy down

Modified: lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java?rev=927228&r1=927227&r2=927228&view=diff
==============================================================================
--- lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java
(original)
+++ lucene/java/branches/flex_1458/src/test/org/apache/lucene/index/TestStressIndexing2.java
Wed Mar 24 23:35:52 2010
@@ -290,14 +290,20 @@ public class TestStressIndexing2 extends
 
     // create mapping from id2 space to id2 based on idField
     idField = StringHelper.intern(idField);
-    final TermsEnum termsEnum = MultiFields.getFields(r1).terms(idField).iterator();
+    final Fields f1 = MultiFields.getFields(r1);
+    if (f1 == null) {
+      // make sure r2 is empty
+      assertNull(MultiFields.getFields(r2));
+      return;
+    }
+    final TermsEnum termsEnum = f1.terms(idField).iterator();
 
     final Bits delDocs1 = MultiFields.getDeletedDocs(r1);
     final Bits delDocs2 = MultiFields.getDeletedDocs(r2);
     
     Fields fields = MultiFields.getFields(r2);
     if (fields == null) {
-      // make sure r1 is in fract empty (eg has only all
+      // make sure r1 is in fact empty (eg has only all
       // deleted docs):
       DocsEnum docs = null;
       while(termsEnum.next() != null) {



Mime
View raw message