You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/08/26 17:45:56 UTC

svn commit: r1162144 [2/2] - in /lucene/dev/branches/flexscoring: ./ dev-tools/idea/lucene/contrib/ lucene/ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/ lucene/contrib/highlighter/src/test/org/apache/lucene/search/vectorhighl...

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestCompoundFile.java Fri Aug 26 15:45:53 2011
@@ -182,11 +182,11 @@ public class TestCompoundFile extends Lu
         for (int i=0; i<data.length; i++) {
             String name = "t" + data[i];
             createSequenceFile(dir, name, (byte) 0, data[i]);
-            CompoundFileDirectory csw = dir.createCompoundOutput(name + ".cfs", newIOContext(random));
+            CompoundFileDirectory csw = new CompoundFileDirectory(dir, name + ".cfs", newIOContext(random), true);
             dir.copy(csw, name, name, newIOContext(random));
             csw.close();
 
-            CompoundFileDirectory csr = dir.openCompoundInput(name + ".cfs", newIOContext(random));
+            CompoundFileDirectory csr = new CompoundFileDirectory(dir, name + ".cfs", newIOContext(random), false);
             IndexInput expected = dir.openInput(name, newIOContext(random));
             IndexInput actual = csr.openInput(name, newIOContext(random));
             assertSameStreams(name, expected, actual);
@@ -205,12 +205,12 @@ public class TestCompoundFile extends Lu
         createSequenceFile(dir, "d1", (byte) 0, 15);
         createSequenceFile(dir, "d2", (byte) 0, 114);
 
-        CompoundFileDirectory csw = dir.createCompoundOutput("d.cfs", newIOContext(random));
+        CompoundFileDirectory csw = new CompoundFileDirectory(dir, "d.cfs", newIOContext(random), true);
         dir.copy(csw, "d1", "d1", newIOContext(random));
         dir.copy(csw, "d2", "d2", newIOContext(random));
         csw.close();
 
-        CompoundFileDirectory csr = dir.openCompoundInput("d.cfs", newIOContext(random));
+        CompoundFileDirectory csr = new CompoundFileDirectory(dir, "d.cfs", newIOContext(random), false);
         IndexInput expected = dir.openInput("d1", newIOContext(random));
         IndexInput actual = csr.openInput("d1", newIOContext(random));
         assertSameStreams("d1", expected, actual);
@@ -255,7 +255,7 @@ public class TestCompoundFile extends Lu
         createRandomFile(dir, segment + ".notIn2", 51);
 
         // Now test
-        CompoundFileDirectory csw = dir.createCompoundOutput("test.cfs", newIOContext(random));
+        CompoundFileDirectory csw = new CompoundFileDirectory(dir, "test.cfs", newIOContext(random), true);
         final String data[] = new String[] {
             ".zero", ".one", ".ten", ".hundred", ".big1", ".big2", ".big3",
             ".big4", ".big5", ".big6", ".big7"
@@ -266,7 +266,7 @@ public class TestCompoundFile extends Lu
         }
         csw.close();
 
-        CompoundFileDirectory csr = dir.openCompoundInput("test.cfs", newIOContext(random));
+        CompoundFileDirectory csr = new CompoundFileDirectory(dir, "test.cfs", newIOContext(random), false);
         for (int i=0; i<data.length; i++) {
             IndexInput check = dir.openInput(segment + data[i], newIOContext(random));
             IndexInput test = csr.openInput(segment + data[i], newIOContext(random));
@@ -285,7 +285,7 @@ public class TestCompoundFile extends Lu
      *  the size of each file is 1000 bytes.
      */
     private void setUp_2() throws IOException {
-        CompoundFileDirectory cw = dir.createCompoundOutput("f.comp", newIOContext(random));
+        CompoundFileDirectory cw = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), true);
         for (int i=0; i<20; i++) {
             createSequenceFile(dir, "f" + i, (byte) 0, 2000);
             String fileName = "f" + i;
@@ -336,7 +336,7 @@ public class TestCompoundFile extends Lu
 
     public void testClonedStreamsClosing() throws IOException {
         setUp_2();
-        CompoundFileDirectory cr = dir.openCompoundInput("f.comp", newIOContext(random));
+        CompoundFileDirectory cr = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), false);
 
         // basic clone
         IndexInput expected = dir.openInput("f11", newIOContext(random));
@@ -388,7 +388,7 @@ public class TestCompoundFile extends Lu
      */
     public void testRandomAccess() throws IOException {
         setUp_2();
-        CompoundFileDirectory cr = dir.openCompoundInput("f.comp", newIOContext(random));
+        CompoundFileDirectory cr = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), false);
 
         // Open two files
         IndexInput e1 = dir.openInput("f11", newIOContext(random));
@@ -467,7 +467,7 @@ public class TestCompoundFile extends Lu
      */
     public void testRandomAccessClones() throws IOException {
         setUp_2();
-        CompoundFileDirectory cr = dir.openCompoundInput("f.comp", newIOContext(random));
+        CompoundFileDirectory cr = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), false);
 
         // Open two files
         IndexInput e1 = cr.openInput("f11", newIOContext(random));
@@ -544,7 +544,7 @@ public class TestCompoundFile extends Lu
 
     public void testFileNotFound() throws IOException {
         setUp_2();
-        CompoundFileDirectory cr = dir.openCompoundInput("f.comp", newIOContext(random));
+        CompoundFileDirectory cr = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), false);
 
         // Open two files
         try {
@@ -562,7 +562,7 @@ public class TestCompoundFile extends Lu
 
     public void testReadPastEOF() throws IOException {
         setUp_2();
-        CompoundFileDirectory cr = dir.openCompoundInput("f.comp", newIOContext(random));
+        CompoundFileDirectory cr = new CompoundFileDirectory(dir, "f.comp", newIOContext(random), false);
         IndexInput is = cr.openInput("f2", newIOContext(random));
         is.seek(is.length() - 10);
         byte b[] = new byte[100];
@@ -615,11 +615,11 @@ public class TestCompoundFile extends Lu
        createSequenceFile(dir, "d1", (byte) 0, 15);
 
        Directory newDir = newDirectory();
-       CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+       CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
        dir.copy(csw, "d1", "d1", newIOContext(random));
        csw.close();
 
-       CompoundFileDirectory csr = newDir.openCompoundInput("d.cfs", newIOContext(random));
+       CompoundFileDirectory csr = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
        IndexInput expected = dir.openInput("d1", newIOContext(random));
        IndexInput actual = csr.openInput("d1", newIOContext(random));
        assertSameStreams("d1", expected, actual);
@@ -634,7 +634,7 @@ public class TestCompoundFile extends Lu
    
   public void testAppend() throws IOException {
     Directory newDir = newDirectory();
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
     int size = 5 + random.nextInt(128);
     for (int j = 0; j < 2; j++) {
       IndexOutput os = csw.createOutput("seg" + j + "_foo.txt", newIOContext(random));
@@ -652,7 +652,7 @@ public class TestCompoundFile extends Lu
     assertEquals(1, listAll.length);
     assertEquals("d.cfs", listAll[0]);
     csw.close();
-    CompoundFileDirectory csr = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csr = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     for (int j = 0; j < 2; j++) {
       IndexInput openInput = csr.openInput("seg" + j + "_foo.txt", newIOContext(random));
       assertEquals(size * 4, openInput.length());
@@ -675,7 +675,7 @@ public class TestCompoundFile extends Lu
   
   public void testAppendTwice() throws IOException {
     Directory newDir = newDirectory();
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
     createSequenceFile(newDir, "d1", (byte) 0, 15);
     IndexOutput out = csw.createOutput("d.xyz", newIOContext(random));
     out.writeInt(0);
@@ -691,7 +691,7 @@ public class TestCompoundFile extends Lu
    
     csw.close();
 
-    CompoundFileDirectory cfr = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    CompoundFileDirectory cfr = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     assertEquals(1, cfr.listAll().length);
     assertEquals("d.xyz", cfr.listAll()[0]);
     cfr.close();
@@ -700,10 +700,10 @@ public class TestCompoundFile extends Lu
   
   public void testEmptyCFS() throws IOException {
     Directory newDir = newDirectory();
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
     csw.close();
 
-    CompoundFileDirectory csr = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csr = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     assertEquals(0, csr.listAll().length);
     csr.close();
 
@@ -712,8 +712,8 @@ public class TestCompoundFile extends Lu
   
   public void testReadNestedCFP() throws IOException {
     Directory newDir = newDirectory();
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
-    CompoundFileDirectory nested = newDir.createCompoundOutput("b.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
+    CompoundFileDirectory nested = new CompoundFileDirectory(newDir, "b.cfs", newIOContext(random), true);
     IndexOutput out = nested.createOutput("b.xyz", newIOContext(random));
     IndexOutput out1 = nested.createOutput("b_1.xyz", newIOContext(random));
     out.writeInt(0);
@@ -728,10 +728,10 @@ public class TestCompoundFile extends Lu
     csw.close();
     
     assertEquals(2, newDir.listAll().length);
-    csw = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     
     assertEquals(2, csw.listAll().length);
-    nested = csw.openCompoundInput("b.cfs", newIOContext(random));
+    nested = new CompoundFileDirectory(csw, "b.cfs", newIOContext(random), false);
     
     assertEquals(2, nested.listAll().length);
     IndexInput openInput = nested.openInput("b.xyz", newIOContext(random));
@@ -747,7 +747,7 @@ public class TestCompoundFile extends Lu
   
   public void testDoubleClose() throws IOException {
     Directory newDir = newDirectory();
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
     IndexOutput out = csw.createOutput("d.xyz", newIOContext(random));
     out.writeInt(0);
     out.close();
@@ -756,7 +756,7 @@ public class TestCompoundFile extends Lu
     // close a second time - must have no effect according to Closeable
     csw.close();
     
-    csw = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     IndexInput openInput = csw.openInput("d.xyz", newIOContext(random));
     assertEquals(0, openInput.readInt());
     openInput.close();
@@ -767,4 +767,41 @@ public class TestCompoundFile extends Lu
     newDir.close();
     
   }
+
+  // Make sure we don't somehow use more than 1 descriptor
+  // when reading a CFS with many subs:
+  public void testManySubFiles() throws IOException {
+
+    final Directory d = newFSDirectory(_TestUtil.getTempDir("CFSManySubFiles"));
+    final int FILE_COUNT = 10000;
+
+    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
+      IndexOutput out = d.createOutput("file." + fileIdx, newIOContext(random));
+      out.writeByte((byte) fileIdx);
+      out.close();
+    }
+    
+    final CompoundFileDirectory cfd = new CompoundFileDirectory(d, "c.cfs", newIOContext(random), true);
+    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
+      final String fileName = "file." + fileIdx;
+      d.copy(cfd, fileName, fileName, newIOContext(random));
+    }
+    cfd.close();
+
+    final IndexInput[] ins = new IndexInput[FILE_COUNT];
+    final CompoundFileDirectory cfr = new CompoundFileDirectory(d, "c.cfs", newIOContext(random), false);
+    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
+      ins[fileIdx] = cfr.openInput("file." + fileIdx, newIOContext(random));
+    }
+
+    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
+      assertEquals((byte) fileIdx, ins[fileIdx].readByte());
+    }
+
+    for(int fileIdx=0;fileIdx<FILE_COUNT;fileIdx++) {
+      ins[fileIdx].close();
+    }
+    cfr.close();
+    d.close();
+  }
 }

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestDocumentWriter.java Fri Aug 26 15:45:53 2011
@@ -149,7 +149,7 @@ public class TestDocumentWriter extends 
       @Override
       public TokenStream tokenStream(String fieldName, Reader reader) {
         return new TokenFilter(new MockTokenizer(reader, MockTokenizer.WHITESPACE, false)) {
-          boolean first=true;
+          boolean first = true;
           AttributeSource.State state;
 
           @Override
@@ -180,9 +180,16 @@ public class TestDocumentWriter extends 
 
           }
 
-          CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
-          PayloadAttribute payloadAtt = addAttribute(PayloadAttribute.class);
-          PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);          
+          @Override
+          public void reset() throws IOException {
+            super.reset();
+            first = true;
+            state = null;
+          }
+
+          final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+          final PayloadAttribute payloadAtt = addAttribute(PayloadAttribute.class);
+          final PositionIncrementAttribute posIncrAtt = addAttribute(PositionIncrementAttribute.class);
         };
       }
     };

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexFileDeleter.java Fri Aug 26 15:45:53 2011
@@ -91,7 +91,7 @@ public class TestIndexFileDeleter extend
     // figure out which field number corresponds to
     // "content", and then set our expected file names below
     // accordingly:
-    CompoundFileDirectory cfsReader = dir.openCompoundInput("_2.cfs", newIOContext(random));
+    CompoundFileDirectory cfsReader = new CompoundFileDirectory(dir, "_2.cfs", newIOContext(random), false);
     FieldInfos fieldInfos = new FieldInfos(cfsReader, "_2.fnm");
     int contentFieldIndex = -1;
     for (FieldInfo fi : fieldInfos) {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java Fri Aug 26 15:45:53 2011
@@ -1660,21 +1660,15 @@ public class TestIndexWriter extends Luc
   }
 
   private static class StringSplitTokenizer extends Tokenizer {
-    private final String[] tokens;
-    private int upto = 0;
+    private String[] tokens;
+    private int upto;
     private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
 
     public StringSplitTokenizer(Reader r) {
       try {
-        final StringBuilder b = new StringBuilder();
-        final char[] buffer = new char[1024];
-        int n;
-        while((n = r.read(buffer)) != -1) {
-          b.append(buffer, 0, n);
-        }
-        tokens = b.toString().split(" ");
-      } catch (IOException ioe) {
-        throw new RuntimeException(ioe);
+        reset(r);
+      } catch (IOException e) {
+        throw new RuntimeException(e);
       }
     }
 
@@ -1690,6 +1684,18 @@ public class TestIndexWriter extends Luc
         return false;
       }
     }
+
+    @Override
+    public void reset(Reader input) throws IOException {
+       this.upto = 0;
+       final StringBuilder b = new StringBuilder();
+       final char[] buffer = new char[1024];
+       int n;
+       while ((n = input.read(buffer)) != -1) {
+         b.append(buffer, 0, n);
+       }
+       this.tokens = b.toString().split(" ");
+    }
   }
 
   /**

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestIndexWriterExceptions.java Fri Aug 26 15:45:53 2011
@@ -447,6 +447,12 @@ public class TestIndexWriterExceptions e
             }
             return input.incrementToken();
           }
+
+          @Override
+          public void reset() throws IOException {
+            super.reset();
+            this.count = 0;
+          }
         };
       }
 

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestPayloads.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestPayloads.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestPayloads.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestPayloads.java Fri Aug 26 15:45:53 2011
@@ -457,7 +457,7 @@ public class TestPayloads extends Lucene
         private byte[] data;
         private int length;
         private int offset;
-        Payload payload = new Payload();
+        private int startOffset;
         PayloadAttribute payloadAtt;
         
         public PayloadFilter(TokenStream in, byte[] data, int offset, int length) {
@@ -465,6 +465,7 @@ public class TestPayloads extends Lucene
             this.data = data;
             this.length = length;
             this.offset = offset;
+            this.startOffset = offset;
             payloadAtt = addAttribute(PayloadAttribute.class);
         }
         
@@ -484,6 +485,12 @@ public class TestPayloads extends Lucene
             
             return hasNext;
         }
+
+      @Override
+      public void reset() throws IOException {
+        super.reset();
+        this.offset = startOffset;
+      }
     }
     
     public void testThreadSafety() throws Exception {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestSameTokenSamePosition.java Fri Aug 26 15:45:53 2011
@@ -21,7 +21,9 @@ import java.io.IOException;
 import java.io.Reader;
 
 import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.ReusableAnalyzerBase;
 import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
@@ -35,7 +37,6 @@ public class TestSameTokenSamePosition e
   /**
    * Attempt to reproduce an assertion error that happens
    * only with the trunk version around April 2011.
-   * @param args
    */
   public void test() throws Exception {
     Directory dir = newDirectory();
@@ -72,16 +73,16 @@ final class BugReproAnalyzer extends Ana
   }
 }
 
-final class BugReproAnalyzerTokenizer extends TokenStream {
+final class BugReproAnalyzerTokenizer extends Tokenizer {
   private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
   private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
   private final PositionIncrementAttribute posIncAtt = addAttribute(PositionIncrementAttribute.class);
-  int tokenCount = 4;
-  int nextTokenIndex = 0;
-  String terms[] = new String[]{"six", "six", "drunken", "drunken"};
-  int starts[] = new int[]{0, 0, 4, 4};
-  int ends[] = new int[]{3, 3, 11, 11};
-  int incs[] = new int[]{1, 0, 1, 0};
+  private final int tokenCount = 4;
+  private int nextTokenIndex = 0;
+  private final String terms[] = new String[]{"six", "six", "drunken", "drunken"};
+  private final int starts[] = new int[]{0, 0, 4, 4};
+  private final int ends[] = new int[]{3, 3, 11, 11};
+  private final int incs[] = new int[]{1, 0, 1, 0};
 
   @Override
   public boolean incrementToken() throws IOException {
@@ -95,4 +96,10 @@ final class BugReproAnalyzerTokenizer ex
       return false;
     }
   }
+
+  @Override
+  public void reset() throws IOException {
+    super.reset();
+    this.nextTokenIndex = 0;
+  }
 }

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermVectorsReader.java Fri Aug 26 15:45:53 2011
@@ -24,8 +24,7 @@ import java.util.Iterator;
 import java.util.Map;
 import java.util.SortedSet;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -131,11 +130,11 @@ public class TestTermVectorsReader exten
   }
 
   private class MyTokenStream extends TokenStream {
-    int tokenUpto;
+    private int tokenUpto;
     
-    CharTermAttribute termAtt;
-    PositionIncrementAttribute posIncrAtt;
-    OffsetAttribute offsetAtt;
+    private final CharTermAttribute termAtt;
+    private final PositionIncrementAttribute posIncrAtt;
+    private final OffsetAttribute offsetAtt;
     
     public MyTokenStream() {
       termAtt = addAttribute(CharTermAttribute.class);
@@ -160,6 +159,12 @@ public class TestTermVectorsReader exten
         return true;
       }
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.tokenUpto = 0;
+    }
   }
 
   private class MyAnalyzer extends Analyzer {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/TestTermdocPerf.java Fri Aug 26 15:45:53 2011
@@ -22,7 +22,9 @@ import java.io.Reader;
 import java.util.Random;
 
 import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.ReusableAnalyzerBase;
 import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -31,13 +33,20 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.BytesRef;
 
-class RepeatingTokenStream extends TokenStream {
-  public int num;
+class RepeatingTokenStream extends Tokenizer {
+  
+  private final Random random;
+  private final float percentDocs;
+  private final int maxTF;
+  private int num;
   CharTermAttribute termAtt;
   String value;
 
-   public RepeatingTokenStream(String val) {
+   public RepeatingTokenStream(String val, Random random, float percentDocs, int maxTF) {
      this.value = val;
+     this.random = random;
+     this.percentDocs = percentDocs;
+     this.maxTF = maxTF;
      this.termAtt = addAttribute(CharTermAttribute.class);
    }
 
@@ -51,19 +60,27 @@ class RepeatingTokenStream extends Token
      }
      return false;
    }
+
+  @Override
+  public void reset() throws IOException {
+    super.reset();
+    if (random.nextFloat() < percentDocs) {
+      num = random.nextInt(maxTF) + 1;
+    } else {
+      num = 0;
+    }
+  }
 }
 
 
 public class TestTermdocPerf extends LuceneTestCase {
 
   void addDocs(final Random random, Directory dir, final int ndocs, String field, final String val, final int maxTF, final float percentDocs) throws IOException {
-    final RepeatingTokenStream ts = new RepeatingTokenStream(val);
+    final RepeatingTokenStream ts = new RepeatingTokenStream(val, random, percentDocs, maxTF);
 
     Analyzer analyzer = new Analyzer() {
       @Override
       public TokenStream tokenStream(String fieldName, Reader reader) {
-        if (random.nextFloat() < percentDocs) ts.num = random.nextInt(maxTF)+1;
-        else ts.num=0;
         return ts;
       }
     };

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/index.34.cfs.zip
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/index.34.cfs.zip?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/index.34.nocfs.zip
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/index/index.34.nocfs.zip?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
Binary files - no diff available.

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java Fri Aug 26 15:45:53 2011
@@ -381,6 +381,13 @@ public class TestMultiPhraseQuery extend
         return false;
       }
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.upto = 0;
+      this.lastPos = 0;
+    }
   }
 
   public void testZeroPosIncr() throws IOException {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java Fri Aug 26 15:45:53 2011
@@ -17,15 +17,12 @@ package org.apache.lucene.search;
  * limitations under the License.
  */
 
+import java.io.IOException;
 import java.io.Reader;
 import java.io.StringReader;
 import java.util.Collection;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockPayloadAnalyzer;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.MockAnalyzer;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -82,6 +79,12 @@ public class TestPositionIncrement exten
             i++;
             return true;
           }
+
+          @Override
+          public void reset() throws IOException {
+            super.reset();
+            this.i = 0;
+          }
         };
       }
     };

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java Fri Aug 26 15:45:53 2011
@@ -57,7 +57,6 @@ public class PayloadHelper {
   public final class PayloadAnalyzer extends Analyzer {
 
 
-
     @Override
     public TokenStream tokenStream(String fieldName, Reader reader) {
       TokenStream result = new MockTokenizer(reader, MockTokenizer.SIMPLE, true);
@@ -67,9 +66,9 @@ public class PayloadHelper {
   }
 
   public final class PayloadFilter extends TokenFilter {
-    String fieldName;
-    int numSeen = 0;
-    PayloadAttribute payloadAtt;
+    private final String fieldName;
+    private int numSeen = 0;
+    private final PayloadAttribute payloadAtt;
     
     public PayloadFilter(TokenStream input, String fieldName) {
       super(input);
@@ -81,18 +80,13 @@ public class PayloadHelper {
     public boolean incrementToken() throws IOException {
       
       if (input.incrementToken()) {
-        if (fieldName.equals(FIELD))
-        {
+        if (fieldName.equals(FIELD)) {
           payloadAtt.setPayload(new Payload(payloadField));
-        }
-        else if (fieldName.equals(MULTI_FIELD))
-        {
-          if (numSeen  % 2 == 0)
-          {
+        } else if (fieldName.equals(MULTI_FIELD)) {
+          if (numSeen  % 2 == 0) {
             payloadAtt.setPayload(new Payload(payloadMultiField1));
           }
-          else
-          {
+          else {
             payloadAtt.setPayload(new Payload(payloadMultiField2));
           }
           numSeen++;
@@ -101,6 +95,12 @@ public class PayloadHelper {
       }
       return false;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.numSeen = 0;
+    }
   }
 
   /**

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java Fri Aug 26 15:45:53 2011
@@ -18,10 +18,7 @@ package org.apache.lucene.search.payload
 import java.io.IOException;
 import java.io.Reader;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -68,9 +65,9 @@ public class TestPayloadNearQuery extend
   }
 
   private static class PayloadFilter extends TokenFilter {
-    String fieldName;
-    int numSeen = 0;
-    protected PayloadAttribute payAtt;
+    private final String fieldName;
+    private int numSeen = 0;
+    private final PayloadAttribute payAtt;
 
     public PayloadFilter(TokenStream input, String fieldName) {
       super(input);
@@ -81,7 +78,7 @@ public class TestPayloadNearQuery extend
     @Override
     public boolean incrementToken() throws IOException {
       boolean result = false;
-      if (input.incrementToken() == true){
+      if (input.incrementToken()) {
         if (numSeen % 2 == 0) {
           payAtt.setPayload(new Payload(payload2));
         } else {
@@ -92,6 +89,12 @@ public class TestPayloadNearQuery extend
       }
       return result;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.numSeen = 0;
+    }
   }
   
   private PayloadNearQuery newPhraseQuery (String fieldName, String phrase, boolean inOrder, PayloadFunction function ) {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java Fri Aug 26 15:45:53 2011
@@ -16,6 +16,7 @@ package org.apache.lucene.search.payload
  * limitations under the License.
  */
 
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.English;
@@ -33,10 +34,6 @@ import org.apache.lucene.search.similari
 import org.apache.lucene.search.spans.MultiSpansWrapper;
 import org.apache.lucene.search.spans.SpanTermQuery;
 import org.apache.lucene.search.spans.Spans;
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.TokenFilter;
 import org.apache.lucene.analysis.tokenattributes.PayloadAttribute;
 import org.apache.lucene.index.FieldInvertState;
 import org.apache.lucene.index.IndexReader;
@@ -78,10 +75,10 @@ public class TestPayloadTermQuery extend
   }
 
   private static class PayloadFilter extends TokenFilter {
-    String fieldName;
-    int numSeen = 0;
+    private final String fieldName;
+    private int numSeen = 0;
     
-    PayloadAttribute payloadAtt;    
+    private final PayloadAttribute payloadAtt;
     
     public PayloadFilter(TokenStream input, String fieldName) {
       super(input);
@@ -108,6 +105,12 @@ public class TestPayloadTermQuery extend
         return false;
       }
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.numSeen = 0;
+    }
   }
 
   @BeforeClass

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java Fri Aug 26 15:45:53 2011
@@ -492,7 +492,6 @@ public class TestPayloadSpans extends Lu
 
   final class PayloadFilter extends TokenFilter {
     String fieldName;
-    int numSeen = 0;
     Set<String> entities = new HashSet<String>();
     Set<String> nopayload = new HashSet<String>();
     int pos;
@@ -530,6 +529,12 @@ public class TestPayloadSpans extends Lu
       }
       return false;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.pos = 0;
+    }
   }
   
   public final class TestPayloadAnalyzer extends Analyzer {

Modified: lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java (original)
+++ lucene/dev/branches/flexscoring/lucene/src/test/org/apache/lucene/store/TestFileSwitchDirectory.java Fri Aug 26 15:45:53 2011
@@ -116,7 +116,7 @@ public class TestFileSwitchDirectory ext
   // LUCENE-3380 test that delegate compound files correctly.
   public void testCompoundFileAppendTwice() throws IOException {
     Directory newDir = newFSSwitchDirectory(Collections.singleton("cfs"));
-    CompoundFileDirectory csw = newDir.createCompoundOutput("d.cfs", newIOContext(random));
+    CompoundFileDirectory csw = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), true);
     createSequenceFile(newDir, "d1", (byte) 0, 15);
     IndexOutput out = csw.createOutput("d.xyz", newIOContext(random));
     out.writeInt(0);
@@ -132,7 +132,7 @@ public class TestFileSwitchDirectory ext
    
     csw.close();
 
-    CompoundFileDirectory cfr = newDir.openCompoundInput("d.cfs", newIOContext(random));
+    CompoundFileDirectory cfr = new CompoundFileDirectory(newDir, "d.cfs", newIOContext(random), false);
     assertEquals(1, cfr.listAll().length);
     assertEquals("d.xyz", cfr.listAll()[0]);
     cfr.close();

Modified: lucene/dev/branches/flexscoring/modules/analysis/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/analysis/CHANGES.txt?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/analysis/CHANGES.txt (original)
+++ lucene/dev/branches/flexscoring/modules/analysis/CHANGES.txt Fri Aug 26 15:45:53 2011
@@ -31,6 +31,8 @@ API Changes
  * LUCENE-2514, LUCENE-2551: JDK and ICU CollationKeyAnalyzers were changed to
    use pure byte keys when Version >= 4.0. This cuts sort key size approximately
    in half. (Robert Muir)
+
+ * LUCENE-3400: Removed DutchAnalyzer.setStemDictionary (Chris Male)
    
 New Features
 

Modified: lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java (original)
+++ lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/miscellaneous/PatternAnalyzer.java Fri Aug 26 15:45:53 2011
@@ -28,6 +28,7 @@ import java.util.regex.Pattern;
 
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
 import org.apache.lucene.analysis.core.StopAnalyzer;
 import org.apache.lucene.analysis.core.StopFilter;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
@@ -220,10 +221,6 @@ public final class PatternAnalyzer exten
    */
   @Override
   public TokenStream tokenStream(String fieldName, Reader reader) {
-    if (reader instanceof FastStringReader) { // fast path
-      return tokenStream(fieldName, ((FastStringReader)reader).getString());
-    }
-    
     try {
       String text = toString(reader);
       return tokenStream(fieldName, text);
@@ -290,6 +287,10 @@ public final class PatternAnalyzer exten
    * @throws IOException if an I/O error occurs while reading the stream
    */
   private static String toString(Reader input) throws IOException {
+    if (input instanceof FastStringReader) { // fast path
+      return ((FastStringReader) input).getString();
+    }
+
     try {
       int len = 256;
       char[] buffer = new char[len];
@@ -324,9 +325,9 @@ public final class PatternAnalyzer exten
    * The work horse; performance isn't fantastic, but it's not nearly as bad
    * as one might think - kudos to the Sun regex developers.
    */
-  private static final class PatternTokenizer extends TokenStream {
+  private static final class PatternTokenizer extends Tokenizer {
     
-    private final String str;
+    private String str;
     private final boolean toLowerCase;
     private Matcher matcher;
     private int pos = 0;
@@ -372,8 +373,20 @@ public final class PatternAnalyzer exten
       // set final offset
       final int finalOffset = str.length();
     	this.offsetAtt.setOffset(finalOffset, finalOffset);
-    }    
-  } 
+    }
+
+    @Override
+    public void reset(Reader input) throws IOException {
+      super.reset(input);
+      this.str = PatternAnalyzer.toString(input);
+    }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.pos = 0;
+    }
+  }
   
   
   ///////////////////////////////////////////////////////////////////////////////
@@ -383,9 +396,9 @@ public final class PatternAnalyzer exten
    * Special-case class for best performance in common cases; this class is
    * otherwise unnecessary.
    */
-  private static final class FastStringTokenizer extends TokenStream {
+  private static final class FastStringTokenizer extends Tokenizer {
     
-    private final String str;
+    private String str;
     private int pos;
     private final boolean isLetter;
     private final boolean toLowerCase;
@@ -464,7 +477,17 @@ public final class PatternAnalyzer exten
     private boolean isStopWord(String text) {
       return stopWords != null && stopWords.contains(text);
     }
-    
+
+    @Override
+    public void reset(Reader input) throws IOException {
+      this.str = PatternAnalyzer.toString(input);
+    }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.pos = 0;
+    }
   }
 
   

Modified: lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java (original)
+++ lucene/dev/branches/flexscoring/modules/analysis/common/src/java/org/apache/lucene/analysis/nl/DutchAnalyzer.java Fri Aug 26 15:45:53 2011
@@ -105,7 +105,7 @@ public final class DutchAnalyzer extends
    */
   private Set<?> excltable = Collections.emptySet();
 
-  private Map<String, String> stemdict = new HashMap<String, String>();
+  private final Map<String, String> stemdict = new HashMap<String, String>();
   private final Version matchVersion;
 
   /**
@@ -130,23 +130,7 @@ public final class DutchAnalyzer extends
     excltable = CharArraySet.unmodifiableSet(CharArraySet.copy(matchVersion, stemExclusionTable));
     this.matchVersion = matchVersion;
   }
-
-  /**
-   * Reads a stemdictionary file , that overrules the stemming algorithm
-   * This is a textfile that contains per line
-   * <tt>word<b>\t</b>stem</tt>, i.e: two tab seperated words
-   */
-  public void setStemDictionary(File stemdictFile) {
-    try {
-      stemdict = WordlistLoader.getStemDict(stemdictFile);
-      setPreviousTokenStream(null); // force a new stemmer to be created
-    } catch (IOException e) {
-      // TODO: throw IOException
-      throw new RuntimeException(e);
-    }
-  }
-
-
+  
   /**
    * Returns a (possibly reused) {@link TokenStream} which tokenizes all the 
    * text in the provided {@link Reader}.

Modified: lucene/dev/branches/flexscoring/modules/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java (original)
+++ lucene/dev/branches/flexscoring/modules/analysis/common/src/test/org/apache/lucene/analysis/nl/TestDutchStemmer.java Fri Aug 26 15:45:53 2011
@@ -150,18 +150,6 @@ public class TestDutchStemmer extends Ba
 
   }
   
-  /* 
-   * Test that changes to the dictionary stemming table are applied immediately
-   * when using reusable token streams.
-   */
-  public void testStemDictionaryReuse() throws Exception {
-    DutchAnalyzer a = new DutchAnalyzer(TEST_VERSION_CURRENT);
-    checkOneTermReuse(a, "lichamelijk", "licham");
-    File customDictFile = getDataFile("customStemDict.txt");
-    a.setStemDictionary(customDictFile);
-    checkOneTermReuse(a, "lichamelijk", "somethingentirelydifferent");
-  }
-  
   /**
    * Prior to 3.1, this analyzer had no lowercase filter.
    * stopwords were case sensitive. Preserve this for back compat.

Modified: lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java (original)
+++ lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiAnalyzer.java Fri Aug 26 15:45:53 2011
@@ -17,18 +17,15 @@ package org.apache.lucene.queryparser.cl
  * limitations under the License.
  */
 
+import java.io.IOException;
 import java.io.Reader;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.TypeAttribute;
 import org.apache.lucene.search.Query;
-import org.apache.lucene.analysis.BaseTokenStreamTestCase;
 import org.apache.lucene.util.Version;
 
 /**
@@ -144,10 +141,10 @@ public class TestMultiAnalyzer extends B
     private int prevStartOffset;
     private int prevEndOffset;
     
-    CharTermAttribute termAtt;
-    PositionIncrementAttribute posIncrAtt;
-    OffsetAttribute offsetAtt;
-    TypeAttribute typeAtt;
+    private final CharTermAttribute termAtt;
+    private final PositionIncrementAttribute posIncrAtt;
+    private final OffsetAttribute offsetAtt;
+    private final TypeAttribute typeAtt;
     
     public TestFilter(TokenStream in) {
       super(in);
@@ -168,7 +165,7 @@ public class TestMultiAnalyzer extends B
         return true;
       } else {
         boolean next = input.incrementToken();
-        if (next == false) {
+        if (!next) {
           return false;
         }
         prevType = typeAtt.type();
@@ -186,6 +183,13 @@ public class TestMultiAnalyzer extends B
         }
       }
     }
+
+    public void reset() throws IOException {
+      super.reset();
+      this.prevType = null;
+      this.prevStartOffset = 0;
+      this.prevEndOffset = 0;
+    }
   }
 
   /**

Modified: lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java (original)
+++ lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/classic/TestMultiPhraseQueryParsing.java Fri Aug 26 15:45:53 2011
@@ -79,6 +79,13 @@ public class TestMultiPhraseQueryParsing
         return false;
       }
     }
+
+    @Override
+    public void reset(Reader reader) throws IOException {
+      super.reset(reader);
+      this.upto = 0;
+      this.lastPos = 0;
+    }
   }
 
   public void testMultiPhraseQueryParsing() throws Exception {

Modified: lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java (original)
+++ lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/precedence/TestPrecedenceQueryParser.java Fri Aug 26 15:45:53 2011
@@ -26,12 +26,7 @@ import java.util.GregorianCalendar;
 import java.util.HashMap;
 import java.util.Map;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.analysis.MockTokenFilter;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.document.DateTools;
@@ -78,13 +73,14 @@ public class TestPrecedenceQueryParser e
       super(in);
     }
 
-    boolean inPhrase = false;
+    private boolean inPhrase = false;
 
-    int savedStart = 0, savedEnd = 0;
+    private int savedStart = 0;
+    private int savedEnd = 0;
 
-    CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
+    private final CharTermAttribute termAtt = addAttribute(CharTermAttribute.class);
 
-    OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
+    private final OffsetAttribute offsetAtt = addAttribute(OffsetAttribute.class);
 
     @Override
     public boolean incrementToken() throws IOException {
@@ -106,6 +102,14 @@ public class TestPrecedenceQueryParser e
             return true;
       return false;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.inPhrase = false;
+      this.savedStart = 0;
+      this.savedEnd = 0;
+    }
   }
 
   public static final class QPTestAnalyzer extends Analyzer {

Modified: lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java (original)
+++ lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestMultiAnalyzerQPHelper.java Fri Aug 26 15:45:53 2011
@@ -17,12 +17,10 @@ package org.apache.lucene.queryparser.fl
  * limitations under the License.
  */
 
+import java.io.IOException;
 import java.io.Reader;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
@@ -184,7 +182,7 @@ public class TestMultiAnalyzerQPHelper e
         return true;
       } else {
         boolean next = input.incrementToken();
-        if (next == false) {
+        if (!next) {
           return false;
         }
         prevType = typeAtt.type();
@@ -203,6 +201,13 @@ public class TestMultiAnalyzerQPHelper e
       }
     }
 
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.prevType = null;
+      this.prevStartOffset = 0;
+      this.prevEndOffset = 0;
+    }
   }
 
   /**

Modified: lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java (original)
+++ lucene/dev/branches/flexscoring/modules/queryparser/src/test/org/apache/lucene/queryparser/flexible/standard/TestQPHelper.java Fri Aug 26 15:45:53 2011
@@ -28,13 +28,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-import org.apache.lucene.analysis.Analyzer;
-import org.apache.lucene.analysis.MockAnalyzer;
-import org.apache.lucene.analysis.MockTokenFilter;
-import org.apache.lucene.analysis.MockTokenizer;
-import org.apache.lucene.analysis.TokenFilter;
-import org.apache.lucene.analysis.TokenStream;
-import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.*;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
 import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
@@ -98,8 +92,9 @@ public class TestQPHelper extends Lucene
       super(in);
     }
 
-    boolean inPhrase = false;
-    int savedStart = 0, savedEnd = 0;
+    private boolean inPhrase = false;
+    private int savedStart = 0;
+    private int savedEnd = 0;
 
     @Override
     public boolean incrementToken() throws IOException {
@@ -123,6 +118,14 @@ public class TestQPHelper extends Lucene
         }
       return false;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.inPhrase = false;
+      this.savedStart = 0;
+      this.savedEnd = 0;
+    }
   }
 
   public static final class QPTestAnalyzer extends Analyzer {
@@ -1203,10 +1206,11 @@ public class TestQPHelper extends Lucene
     super.tearDown();
   }
 
-  private class CannedTokenStream extends TokenStream {
+  private class CannedTokenStream extends Tokenizer {
     private int upto = 0;
-    final PositionIncrementAttribute posIncr = addAttribute(PositionIncrementAttribute.class);
-    final CharTermAttribute term = addAttribute(CharTermAttribute.class);
+    private final PositionIncrementAttribute posIncr = addAttribute(PositionIncrementAttribute.class);
+    private final CharTermAttribute term = addAttribute(CharTermAttribute.class);
+    
     @Override
     public boolean incrementToken() {
       clearAttributes();
@@ -1229,6 +1233,12 @@ public class TestQPHelper extends Lucene
       upto++;
       return true;
     }
+
+    @Override
+    public void reset() throws IOException {
+      super.reset();
+      this.upto = 0;
+    }
   }
 
   private class CannedAnalyzer extends Analyzer {

Modified: lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/CHANGES.txt?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/CHANGES.txt (original)
+++ lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/CHANGES.txt Fri Aug 26 15:45:53 2011
@@ -21,6 +21,7 @@ Bug Fixes
 * SOLR-2186: DataImportHandler's multi-threaded option throws NPE (Lance Norskog, Frank Wesemann, shalin)
 * SOLR-2655: DIH multi threaded mode does not resolve attributes correctly (Frank Wesemann, shalin)
 * SOLR-2695: Documents are collected in unsynchronized list in multi-threaded debug mode (Michael McCandless, shalin)
+* SOLR-2668: DIH multithreaded mode does not rollback on errors from EntityProcessor (Frank Wesemann, shalin)
 
 ==================  3.3.0 ==================
 

Modified: lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java (original)
+++ lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/java/org/apache/solr/handler/dataimport/DocBuilder.java Fri Aug 26 15:45:53 2011
@@ -305,7 +305,7 @@ public class DocBuilder {
         LOG.info("running multithreaded full-import");
         new EntityRunner(root,null).run(null,Context.FULL_DUMP,null);
       } catch (Exception e) {
-        LOG.error("error in import", e);
+        throw new RuntimeException("Error in multi-threaded import", e);
       }
     } else {
       buildDocument(getVariableResolver(), null, null, root, true, null);

Modified: lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilderThreaded.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilderThreaded.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilderThreaded.java (original)
+++ lucene/dev/branches/flexscoring/solr/contrib/dataimporthandler/src/test/org/apache/solr/handler/dataimport/TestDocBuilderThreaded.java Fri Aug 26 15:45:53 2011
@@ -16,15 +16,15 @@
  */
 package org.apache.solr.handler.dataimport;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
 
 /**
  * Test DocBuilder with "threads"
@@ -60,6 +60,8 @@ public class TestDocBuilderThreaded exte
     DemoProcessor.entitiesInitied = 0;
     DemoEvaluator.evaluated = 0;
     MockDataSource.clearCache();
+    assertU(delQ("*:*"));
+    assertU(commit());
     super.tearDown();
   }
 
@@ -86,6 +88,23 @@ public class TestDocBuilderThreaded exte
     assertEquals("Evaluator was invoked less times than the number of rows",
         4, DemoEvaluator.evaluated);
   }
+  @Test 
+  public void testContinue() throws Exception {
+    runFullImport(twoEntitiesWithFailingProcessor);
+    assertQ(req("*:*"), "//*[@numFound='0']"); // should rollback
+  }
+  
+  @Test
+  public void testContinueThreaded() throws Exception {
+    runFullImport(twoThreadedEntitiesWithFailingProcessor);
+    assertQ(req("*:*"), "//*[@numFound='0']"); // should rollback
+  }
+
+  @Test
+  public void testFailingTransformerContinueThreaded() throws Exception {
+    runFullImport(twoThreadedEntitiesWithFailingTransformer);
+    assertQ(req("*:*"), "//*[@numFound='4']");
+  }
 
   @SuppressWarnings("unchecked")
   private List<Map<String, Object>> getDetails4Worker(String aWorker) {
@@ -116,8 +135,7 @@ public class TestDocBuilderThreaded exte
           "</entity>" +
           "</document>" +
           "</dataConfig>";
-
-  private final String twoEntitiesWithProcessor =
+	private final String twoEntitiesWithProcessor =
 
       "<dataConfig> <dataSource type=\"MockDataSource\"/>\n" +
           "<document>" +
@@ -138,7 +156,7 @@ public class TestDocBuilderThreaded exte
           "</entity>" +
           "</document>" +
           "</dataConfig>";
-
+          
   private final String twoEntitiesWithEvaluatorProcessor =
 
       "<dataConfig> <dataSource type=\"MockDataSource\"/>\n" +
@@ -164,6 +182,89 @@ public class TestDocBuilderThreaded exte
           "</dataConfig>";
 
 
+  private final String twoThreadedEntitiesWithFailingProcessor =
+  
+        "<dataConfig> <dataSource type=\"MockDataSource\"/>\n" +
+            "<document>" +
+            "<entity name=\"job\" processor=\"TestDocBuilderThreaded$DemoProcessor\" \n" +
+            " threads=\"1\" " +
+            " query=\"select * from y\"" +
+            " pk=\"id\" \n" +
+            " worker=\"id\" \n" +
+            " onError=\"continue\" " +
+            ">" +
+            "<field column=\"id\" />\n" +
+            "<entity name=\"details\" processor=\"TestDocBuilderThreaded$FailingProcessor\" \n" +
+            "worker=\"${job.worker}\" \n" +
+            "query=\"${job.worker}\" \n" +
+            "transformer=\"TemplateTransformer\" " +
+            "onError=\"continue\" " +
+            "fail=\"yes\" " +
+            " >" +
+            "<field column=\"author_s\" />" +
+            "<field column=\"title_s\" />" +
+            " <field column=\"text_s\" />" +
+            " <field column=\"generated_id_s\" template=\"generated_${job.id}\" />" +
+            "</entity>" +
+            "</entity>" +
+            "</document>" +
+            "</dataConfig>";
+  
+  private final String twoEntitiesWithFailingProcessor =
+    
+    "<dataConfig> <dataSource type=\"MockDataSource\"/>\n" +
+        "<document>" +
+        "<entity name=\"job\" processor=\"TestDocBuilderThreaded$DemoProcessor\" \n" +
+        " query=\"select * from y\"" +
+        " pk=\"id\" \n" +
+        " worker=\"id\" \n" +
+        " onError=\"continue\" " +
+        ">" +
+        "<field column=\"id\" />\n" +
+        "<entity name=\"details\" processor=\"TestDocBuilderThreaded$FailingProcessor\" \n" +
+        "worker=\"${job.worker}\" \n" +
+        "query=\"${job.worker}\" \n" +
+        "transformer=\"TemplateTransformer\" " +
+        "onError=\"continue\" " +
+        "fail=\"yes\" " +
+        " >" +
+        "<field column=\"author_s\" />" +
+        "<field column=\"title_s\" />" +
+        " <field column=\"text_s\" />" +
+        " <field column=\"generated_id_s\" template=\"generated_${job.id}\" />" +
+        "</entity>" +
+        "</entity>" +
+        "</document>" +
+        "</dataConfig>";
+
+  private final String twoThreadedEntitiesWithFailingTransformer =
+
+    "<dataConfig> <dataSource type=\"MockDataSource\"/>\n" +
+        "<document>" +
+        "<entity name=\"job\" processor=\"TestDocBuilderThreaded$DemoProcessor\" \n" +
+        " threads=\"1\" " +
+        " query=\"select * from y\"" +
+        " pk=\"id\" \n" +
+        " worker=\"id\" \n" +
+        " onError=\"continue\" " +
+        ">" +
+        "<field column=\"id\" />\n" +
+        "<entity name=\"details\" \n" +
+        "worker=\"${job.worker}\" \n" +
+        "query=\"${job.worker}\" \n" +
+        "transformer=\"TestDocBuilderThreaded$FailingTransformer\" " +
+        "onError=\"continue\" " +
+        " >" +
+        "<field column=\"author_s\" />" +
+        "<field column=\"title_s\" />" +
+        " <field column=\"text_s\" />" +
+        " <field column=\"generated_id_s\" template=\"generated_${job.id}\" />" +
+        "</entity>" +
+        "</entity>" +
+        "</document>" +
+        "</dataConfig>";
+
+
   public static class DemoProcessor extends SqlEntityProcessor {
 
     public static int entitiesInitied = 0;
@@ -177,6 +278,23 @@ public class TestDocBuilderThreaded exte
       } else entitiesInitied++;
     }
   }
+  public static class FailingProcessor extends SqlEntityProcessor {
+    @Override
+    public void init(Context context) {
+      super.init(context);
+      String fail = context.getResolvedEntityAttribute("fail");
+      if (fail != null && fail.equalsIgnoreCase("yes")) {
+        throw new NullPointerException("I was told to");
+      }      
+    }
+  }
+
+  public static class FailingTransformer extends Transformer  {
+    @Override
+    public Object transformRow(Map<String, Object> row, Context context) {
+      throw new RuntimeException("Always fail");
+    }
+  }
 
   public static class DemoEvaluator extends Evaluator {
     public static int evaluated = 0;
@@ -196,4 +314,5 @@ public class TestDocBuilderThreaded exte
       return result.toString();
     }
   }
+  
 }

Modified: lucene/dev/branches/flexscoring/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java (original)
+++ lucene/dev/branches/flexscoring/solr/core/src/java/org/apache/solr/update/DirectUpdateHandler2.java Fri Aug 26 15:45:53 2011
@@ -187,7 +187,9 @@ public class DirectUpdateHandler2 extend
 
     if (commitTracker.getTimeUpperBound() > 0) {
       commitTracker.scheduleCommitWithin(commitTracker.getTimeUpperBound());
-    } else if (softCommitTracker.getTimeUpperBound() > 0) {
+    } 
+    
+    if (softCommitTracker.getTimeUpperBound() > 0) {
       softCommitTracker.scheduleCommitWithin(softCommitTracker.getTimeUpperBound());
     }
   }
@@ -219,7 +221,9 @@ public class DirectUpdateHandler2 extend
       
       if (commitTracker.getTimeUpperBound() > 0) {
         commitTracker.scheduleCommitWithin(commitTracker.getTimeUpperBound());
-      } else if (softCommitTracker.getTimeUpperBound()> 0) {
+      } 
+      
+      if (softCommitTracker.getTimeUpperBound()> 0) {
         softCommitTracker.scheduleCommitWithin(softCommitTracker.getTimeUpperBound());
       }
       

Modified: lucene/dev/branches/flexscoring/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java (original)
+++ lucene/dev/branches/flexscoring/solr/core/src/test/org/apache/solr/update/AutoCommitTest.java Fri Aug 26 15:45:53 2011
@@ -235,7 +235,6 @@ public class AutoCommitTest extends Abst
     assertEquals( 3, tracker.getCommitCount() );
 
     assertQ("now it should", req("id:500") ,"//result[@numFound=1]" );
-    assertQ("but not this", req("id:531") ,"//result[@numFound=0]" );
   }
 
   public void testSoftCommitMaxDocs() throws Exception {
@@ -402,10 +401,8 @@ public class AutoCommitTest extends Abst
     core.registerNewSearcherListener(hardTrigger);
     DirectUpdateHandler2 updater = (DirectUpdateHandler2) core.getUpdateHandler();
     
-    updater.registerCommitCallback(softTrigger);
     updater.registerSoftCommitCallback(softTrigger);
     updater.registerCommitCallback(hardTrigger);
-    updater.registerSoftCommitCallback(hardTrigger);
     
     CommitTracker hardTracker = updater.commitTracker;
     CommitTracker softTracker = updater.softCommitTracker;
@@ -450,8 +447,8 @@ public class AutoCommitTest extends Abst
     assertU( delI("529") );
     assertQ("deleted, but should still be there", req("id:529") ,"//result[@numFound=1]" );
     
-    // Wait longer than the autocommit time - wait twice to ensure latest is picked up
-    assertTrue(softTrigger.waitForNewSearcher(15000));
+    // Wait longer than the autocommit time
+    assertTrue(softTrigger.waitForNewSearcher(30000));
     softTrigger.reset();
 
     
@@ -472,7 +469,7 @@ public class AutoCommitTest extends Abst
     assertQ("should not be there yet", req("id:500") ,"//result[@numFound=0]" );
     
     // Wait longer than the autocommit time
-    assertTrue(softTrigger.waitForNewSearcher(15000));
+    assertTrue(softTrigger.waitForNewSearcher(30000));
     softTrigger.reset();
     
     req.setContentStreams( toContentStreams(
@@ -485,14 +482,14 @@ public class AutoCommitTest extends Abst
         || softCommitCnt == 3);
     
     // depending on timing, you might see 1 or 2 hard commits
-    assertTrue(hardTrigger.waitForNewSearcher(15000));
+    assertTrue(hardTrigger.waitForNewSearcher(30000));
     hardTrigger.reset();
     
     int hardCommitCnt = hardTracker.getCommitCount();
     assertTrue("commit cnt:" + hardCommitCnt, hardCommitCnt == 1
         || hardCommitCnt == 2);
     
-    assertTrue(softTrigger.waitForNewSearcher(15000));
+    assertTrue(softTrigger.waitForNewSearcher(30000));
     softTrigger.reset();
     
     assertQ("now it should", req("id:500") ,"//result[@numFound=1]" );

Modified: lucene/dev/branches/flexscoring/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/flexscoring/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java?rev=1162144&r1=1162143&r2=1162144&view=diff
==============================================================================
--- lucene/dev/branches/flexscoring/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java (original)
+++ lucene/dev/branches/flexscoring/solr/solrj/src/test/org/apache/solr/client/solrj/TestLBHttpSolrServer.java Fri Aug 26 15:45:53 2011
@@ -162,8 +162,8 @@ public class TestLBHttpSolrServer extend
     }
     HttpClient myHttpClient = new HttpClient(new MultiThreadedHttpConnectionManager());
 
-    myHttpClient.getParams().setParameter("http.connection.timeout", new Integer(100));
-    myHttpClient.getParams().setParameter("http.socket.timeout", new Integer(100));
+    myHttpClient.getParams().setParameter("http.connection.timeout", new Integer(250));
+    myHttpClient.getParams().setParameter("http.socket.timeout", new Integer(250));
     LBHttpSolrServer lbHttpSolrServer = new LBHttpSolrServer(myHttpClient, s);
     lbHttpSolrServer.setAliveCheckInterval(500);