lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r996357 - in /lucene/dev/trunk/lucene/src: java/org/apache/lucene/index/codecs/preflex/ test/org/apache/lucene/search/ test/org/apache/lucene/search/spans/
Date Sun, 12 Sep 2010 18:28:11 GMT
Author: rmuir
Date: Sun Sep 12 18:28:10 2010
New Revision: 996357

URL: http://svn.apache.org/viewvc?rev=996357&view=rev
Log:
LUCENE-2641: fix perf bugs in PreFlex codec; speed up tests

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/PreFlexFields.java Sun Sep 12 18:28:10 2010
@@ -21,6 +21,8 @@ import java.io.IOException;
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.TreeMap;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Comparator;
 
 import org.apache.lucene.index.DocsEnum;
@@ -55,6 +57,7 @@ public class PreFlexFields extends Field
   final private FieldInfos fieldInfos;
   private final SegmentInfo si;
   final TreeMap<String,FieldInfo> fields = new TreeMap<String,FieldInfo>();
+  final Map<String,Terms> preTerms = new HashMap<String,Terms>();
   private final Directory dir;
   private final int readBufferSize;
   private Directory cfsReader;
@@ -91,6 +94,7 @@ public class PreFlexFields extends Field
       final FieldInfo fieldInfo = fieldInfos.fieldInfo(i);
       if (fieldInfo.isIndexed) {
         fields.put(fieldInfo.name, fieldInfo);
+        preTerms.put(fieldInfo.name, new PreTerms(fieldInfo));
         if (!fieldInfo.omitTermFreqAndPositions) {
           anyProx = true;
         }
@@ -139,12 +143,7 @@ public class PreFlexFields extends Field
 
   @Override
   public Terms terms(String field) {
-    FieldInfo fi = fieldInfos.fieldInfo(field);
-    if (fi != null) {
-      return new PreTerms(fi);
-    } else {
-      return null;
-    }
+    return preTerms.get(field);
   }
 
   synchronized private TermInfosReader getTermsDict() {

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java (original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/index/codecs/preflex/TermInfosReader.java Sun Sep 12 18:28:10 2010
@@ -62,13 +62,14 @@ public final class TermInfosReader {
   }
 
   private static class CloneableTerm extends DoubleBarrelLRUCache.CloneableKey {
-    private Term term;
+    Term term;
     public CloneableTerm(Term t) {
       this.term = t;
     }
 
     public boolean equals(Object other) {
-      return this.term.equals(other);
+      CloneableTerm t = (CloneableTerm) other;
+      return this.term.equals(t.term);
     }
 
     public int hashCode() {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/BaseTestRangeFilter.java Sun Sep 12 18:28:10 2010
@@ -20,7 +20,8 @@ package org.apache.lucene.search;
 import java.io.IOException;
 import java.util.Random;
 
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util._TestUtil;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
@@ -28,8 +29,12 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.IndexWriterConfig.OpenMode;
 import org.apache.lucene.store.Directory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+import static org.junit.Assert.*;
 
-public class BaseTestRangeFilter extends LuceneTestCase {
+public class BaseTestRangeFilter extends LuceneTestCaseJ4 {
   
   public static final boolean F = false;
   public static final boolean T = true;
@@ -40,7 +45,7 @@ public class BaseTestRangeFilter extends
    * one which can't have negative random integers, for testing collated ranges,
    * and the other which can have negative random integers, for all other tests.
    */
-  class TestIndex {
+  static class TestIndex {
     int maxR;
     int minR;
     boolean allowNegativeRandomInts;
@@ -51,19 +56,19 @@ public class BaseTestRangeFilter extends
       this.maxR = maxR;
       this.allowNegativeRandomInts = allowNegativeRandomInts;
       try {
-        index = newDirectory();
+        index = newDirectory(random);
       } catch (IOException e) { throw new RuntimeException(e); }
     }
   }
   
-  IndexReader signedIndexReader;
-  IndexReader unsignedIndexReader;
+  static IndexReader signedIndexReader;
+  static IndexReader unsignedIndexReader;
   
-  TestIndex signedIndexDir;
-  TestIndex unsignedIndexDir;
+  static TestIndex signedIndexDir;
+  static TestIndex unsignedIndexDir;
   
-  int minId = 0;
-  int maxId = 10000;
+  static int minId = 0;
+  static int maxId = 10000;
   
   static final int intLength = Integer.toString(Integer.MAX_VALUE).length();
   
@@ -86,33 +91,44 @@ public class BaseTestRangeFilter extends
     
     return b.toString();
   }
-   
-  protected void setUp() throws Exception {
-    super.setUp();
+  
+  @BeforeClass
+  public static void beforeClassBaseTestRangeFilter() throws Exception {
+    Random random = newStaticRandom(BaseTestRangeFilter.class);
     signedIndexDir = new TestIndex(random, Integer.MAX_VALUE, Integer.MIN_VALUE, true);
     unsignedIndexDir = new TestIndex(random, Integer.MAX_VALUE, 0, false);
     signedIndexReader = build(random, signedIndexDir);
     unsignedIndexReader = build(random, unsignedIndexDir);
   }
   
-  protected void tearDown() throws Exception {
+  @AfterClass
+  public static void afterClassBaseTestRangeFilter() throws Exception {
     signedIndexReader.close();
     unsignedIndexReader.close();
     signedIndexDir.index.close();
     unsignedIndexDir.index.close();
-    super.tearDown();
+    signedIndexReader = null;
+    unsignedIndexReader = null;
+    signedIndexDir = null;
+    unsignedIndexDir = null;
   }
   
-  private IndexReader build(Random random, TestIndex index) throws IOException {
+  private static IndexReader build(Random random, TestIndex index) throws IOException {
     /* build an index */
     RandomIndexWriter writer = new RandomIndexWriter(random, index.index, 
-        newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer())
-    .setOpenMode(OpenMode.CREATE));
+        newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
+    .setOpenMode(OpenMode.CREATE).setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
+    
+    Document doc = new Document();
+    Field idField = newField(random, "id", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
+    Field randField = newField(random, "rand", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
+    Field bodyField = newField(random, "body", "", Field.Store.YES, Field.Index.NOT_ANALYZED);
+    doc.add(idField);
+    doc.add(randField);
+    doc.add(bodyField);
     
     for (int d = minId; d <= maxId; d++) {
-      Document doc = new Document();
-      doc.add(newField("id", pad(d), Field.Store.YES,
-          Field.Index.NOT_ANALYZED));
+      idField.setValue(pad(d));
       int r = index.allowNegativeRandomInts ? random.nextInt() : random
           .nextInt(Integer.MAX_VALUE);
       if (index.maxR < r) {
@@ -121,10 +137,8 @@ public class BaseTestRangeFilter extends
       if (r < index.minR) {
         index.minR = r;
       }
-      doc.add(newField("rand", pad(r), Field.Store.YES,
-          Field.Index.NOT_ANALYZED));
-      doc.add(newField("body", "body", Field.Store.YES,
-          Field.Index.NOT_ANALYZED));
+      randField.setValue(pad(r));
+      bodyField.setValue("body");
       writer.addDocument(doc);
     }
     
@@ -133,6 +147,7 @@ public class BaseTestRangeFilter extends
     return ir;
   }
   
+  @Test
   public void testPad() {
     
     int[] tests = new int[] {-9999999, -99560, -100, -3, -1, 0, 3, 9, 10, 1000,

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java Sun Sep 12 18:28:10 2010
@@ -31,30 +31,36 @@ import org.apache.lucene.queryParser.Que
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.MockDirectoryWrapper;
 import org.apache.lucene.store.RAMDirectory;
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util._TestUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /** Test BooleanQuery2 against BooleanQuery by overriding the standard query parser.
  * This also tests the scoring order of BooleanQuery.
  */
-public class TestBoolean2 extends LuceneTestCase {
-  private IndexSearcher searcher;
-  private IndexSearcher bigSearcher;
-  private IndexReader reader;
+public class TestBoolean2 extends LuceneTestCaseJ4 {
+  private static IndexSearcher searcher;
+  private static IndexSearcher bigSearcher;
+  private static IndexReader reader;
   private static int NUM_EXTRA_DOCS = 6000;
 
   public static final String field = "field";
-  private Directory directory;
-  private Directory dir2;
-  private int mulFactor;
-
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
-    directory = newDirectory();
+  private static Directory directory;
+  private static Directory dir2;
+  private static int mulFactor;
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    Random random = newStaticRandom(TestBoolean2.class);
+    directory = newDirectory(random);
     RandomIndexWriter writer= new RandomIndexWriter(random, directory);
     for (int i = 0; i < docFields.length; i++) {
       Document doc = new Document();
-      doc.add(newField(field, docFields[i], Field.Store.NO, Field.Index.ANALYZED));
+      doc.add(newField(random, field, docFields[i], Field.Store.NO, Field.Index.ANALYZED));
       writer.addDocument(doc);
     }
     writer.close();
@@ -75,14 +81,16 @@ public class TestBoolean2 extends Lucene
       mulFactor *= 2;
     } while(docCount < 3000);
 
-    RandomIndexWriter w = new RandomIndexWriter(random, dir2);
+    RandomIndexWriter w = new RandomIndexWriter(random, dir2, 
+        newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     Document doc = new Document();
-    doc.add(newField("field2", "xxx", Field.Store.NO, Field.Index.ANALYZED));
+    doc.add(newField(random, "field2", "xxx", Field.Store.NO, Field.Index.ANALYZED));
     for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
       w.addDocument(doc);
     }
     doc = new Document();
-    doc.add(newField("field2", "big bad bug", Field.Store.NO, Field.Index.ANALYZED));
+    doc.add(newField(random, "field2", "big bad bug", Field.Store.NO, Field.Index.ANALYZED));
     for(int i=0;i<NUM_EXTRA_DOCS/2;i++) {
       w.addDocument(doc);
     }
@@ -91,16 +99,21 @@ public class TestBoolean2 extends Lucene
     w.close();
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  @AfterClass
+  public static void afterClass() throws Exception {
     searcher.close();
     reader.close();
     dir2.close();
     directory.close();
-    super.tearDown();
+    bigSearcher.close();
+    searcher = null;
+    reader = null;
+    dir2 = null;
+    directory = null;
+    bigSearcher = null;
   }
 
-  private String[] docFields = {
+  private static String[] docFields = {
     "w1 w2 w3 w4 w5",
     "w1 w3 w2 w3",
     "w1 xx w2 yy w3",
@@ -132,72 +145,88 @@ public class TestBoolean2 extends Lucene
     CheckHits.checkHitsQuery(query2, hits1, hits2, expDocNrs);
   }
 
+  @Test
   public void testQueries01() throws Exception {
     String queryText = "+w3 +xx";
     int[] expDocNrs = {2,3};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries02() throws Exception {
     String queryText = "+w3 xx";
     int[] expDocNrs = {2,3,1,0};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries03() throws Exception {
     String queryText = "w3 xx";
     int[] expDocNrs = {2,3,1,0};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries04() throws Exception {
     String queryText = "w3 -xx";
     int[] expDocNrs = {1,0};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries05() throws Exception {
     String queryText = "+w3 -xx";
     int[] expDocNrs = {1,0};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries06() throws Exception {
     String queryText = "+w3 -xx -w5";
     int[] expDocNrs = {1};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries07() throws Exception {
     String queryText = "-w3 -xx -w5";
     int[] expDocNrs = {};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries08() throws Exception {
     String queryText = "+w3 xx -w5";
     int[] expDocNrs = {2,3,1};
     queriesTest(queryText, expDocNrs);
   }
 
+  @Test
   public void testQueries09() throws Exception {
     String queryText = "+w3 +xx +w2 zz";
     int[] expDocNrs = {2, 3};
     queriesTest(queryText, expDocNrs);
   }
 
-    public void testQueries10() throws Exception {
+  @Test
+  public void testQueries10() throws Exception {
     String queryText = "+w3 +xx +w2 zz";
     int[] expDocNrs = {2, 3};
-    searcher.setSimilarity(new DefaultSimilarity(){
-      @Override
-      public float coord(int overlap, int maxOverlap) {
-        return overlap / ((float)maxOverlap - 1);
-      }
-    });
-    queriesTest(queryText, expDocNrs);
+    Similarity oldSimilarity = searcher.getSimilarity();
+    try {
+      searcher.setSimilarity(new DefaultSimilarity(){
+        @Override
+        public float coord(int overlap, int maxOverlap) {
+          return overlap / ((float)maxOverlap - 1);
+        }
+      });
+      queriesTest(queryText, expDocNrs);
+    } finally {
+      searcher.setSimilarity(oldSimilarity);
+    }
   }
 
+  @Test
   public void testRandomQueries() throws Exception {
     String[] vals = {"w1","w2","w3","w4","w5","xx","yy","zzz"};
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Sun Sep 12 18:28:10 2010
@@ -27,6 +27,9 @@ import org.apache.lucene.analysis.MockAn
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.store.Directory;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * A basic 'positive' Unit test class for the FieldCacheRangeFilter class.
@@ -39,6 +42,7 @@ import org.apache.lucene.store.Directory
  */
 public class TestFieldCacheRangeFilter extends BaseTestRangeFilter {
 
+  @Test
   public void testRangeFilterId() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -123,6 +127,7 @@ public class TestFieldCacheRangeFilter e
         
   }
 
+  @Test
   public void testFieldCacheRangeFilterRand() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -186,6 +191,7 @@ public class TestFieldCacheRangeFilter e
   
   // byte-ranges cannot be tested, because all ranges are too big for bytes, need an extra range for that
 
+  @Test
   public void testFieldCacheRangeFilterShorts() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -275,6 +281,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("inverse range", 0, result.length);
   }
   
+  @Test
   public void testFieldCacheRangeFilterInts() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -365,6 +372,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("inverse range", 0, result.length);
   }
   
+  @Test
   public void testFieldCacheRangeFilterLongs() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -457,6 +465,7 @@ public class TestFieldCacheRangeFilter e
   
   // float and double tests are a bit minimalistic, but its complicated, because missing precision
   
+  @Test
   public void testFieldCacheRangeFilterFloats() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -485,6 +494,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("infinity special case", 0, result.length);
   }
   
+  @Test
   public void testFieldCacheRangeFilterDoubles() throws IOException {
 
     IndexReader reader = signedIndexReader;
@@ -514,6 +524,7 @@ public class TestFieldCacheRangeFilter e
   }
   
   // test using a sparse index (with deleted docs).
+  @Test
   public void testSparseIndex() throws IOException {
     Directory dir = newDirectory();
     IndexWriter writer = new IndexWriter(dir, newIndexWriterConfig( TEST_VERSION_CURRENT, new MockAnalyzer()));

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Sun Sep 12 18:28:10 2010
@@ -25,9 +25,16 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
 import java.io.IOException;
 import java.text.Collator;
 import java.util.Locale;
+import java.util.Random;
 
 import junit.framework.Assert;
 
@@ -36,36 +43,37 @@ public class TestMultiTermConstantScore 
   /** threshold for comparing floats */
   public static final float SCORE_COMP_THRESH = 1e-6f;
 
-  Directory small;
-  IndexReader reader;
+  static Directory small;
+  static IndexReader reader;
 
   void assertEquals(String m, float e, float a) {
-    assertEquals(m, e, a, SCORE_COMP_THRESH);
+    Assert.assertEquals(m, e, a, SCORE_COMP_THRESH);
   }
 
   static public void assertEquals(String m, int e, int a) {
     Assert.assertEquals(m, e, a);
   }
 
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
+  @BeforeClass
+  public static void beforeClass() throws Exception {
     String[] data = new String[] { "A 1 2 3 4 5 6", "Z       4 5 6", null,
         "B   2   4 5 6", "Y     3   5 6", null, "C     3     6",
         "X       4 5 6" };
 
-    small = newDirectory();
+    Random random = newStaticRandom(TestMultiTermConstantScore.class);
+    
+    small = newDirectory(random);
     RandomIndexWriter writer = new RandomIndexWriter(random, small, new MockAnalyzer(MockTokenizer.WHITESPACE, false));
 
     for (int i = 0; i < data.length; i++) {
       Document doc = new Document();
-      doc.add(newField("id", String.valueOf(i), Field.Store.YES,
+      doc.add(newField(random, "id", String.valueOf(i), Field.Store.YES,
           Field.Index.NOT_ANALYZED));// Field.Keyword("id",String.valueOf(i)));
       doc
-          .add(newField("all", "all", Field.Store.YES,
+          .add(newField(random, "all", "all", Field.Store.YES,
               Field.Index.NOT_ANALYZED));// Field.Keyword("all","all"));
       if (null != data[i]) {
-        doc.add(newField("data", data[i], Field.Store.YES,
+        doc.add(newField(random, "data", data[i], Field.Store.YES,
             Field.Index.ANALYZED));// Field.Text("data",data[i]));
       }
       writer.addDocument(doc);
@@ -75,11 +83,12 @@ public class TestMultiTermConstantScore 
     writer.close();
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  @AfterClass
+  public static void afterClass() throws Exception {
     reader.close();
     small.close();
-    super.tearDown();
+    reader = null;
+    small = null;
   }
 
   /** macro for readability */
@@ -117,6 +126,7 @@ public class TestMultiTermConstantScore 
     return query;
   }
 
+  @Test
   public void testBasics() throws IOException {
     QueryUtils.check(csrq("data", "1", "6", T, T));
     QueryUtils.check(csrq("data", "A", "Z", T, T));
@@ -132,6 +142,7 @@ public class TestMultiTermConstantScore 
         "data", "pr*t?j")));
   }
 
+  @Test
   public void testBasicsRngCollating() throws IOException {
     Collator c = Collator.getInstance(Locale.ENGLISH);
     QueryUtils.check(csrq("data", "1", "6", T, T, c));
@@ -140,6 +151,7 @@ public class TestMultiTermConstantScore 
         "Z", T, T, c));
   }
 
+  @Test
   public void testEqualScores() throws IOException {
     // NOTE: uses index build in *this* setUp
 
@@ -168,6 +180,7 @@ public class TestMultiTermConstantScore 
 
   }
 
+  @Test
   public void testBoost() throws IOException {
     // NOTE: uses index build in *this* setUp
 
@@ -210,8 +223,8 @@ public class TestMultiTermConstantScore 
     bq.add(q2, BooleanClause.Occur.SHOULD);
 
     ScoreDoc[] hits = search.search(bq, null, 1000).scoreDocs;
-    assertEquals(1, hits[0].doc);
-    assertEquals(0, hits[1].doc);
+    Assert.assertEquals(1, hits[0].doc);
+    Assert.assertEquals(0, hits[1].doc);
     assertTrue(hits[0].score > hits[1].score);
 
     q1 = csrq("data", "A", "A", T, T, MultiTermQuery.CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE); // matches document #0
@@ -222,8 +235,8 @@ public class TestMultiTermConstantScore 
     bq.add(q2, BooleanClause.Occur.SHOULD);
 
     hits = search.search(bq, null, 1000).scoreDocs;
-    assertEquals(1, hits[0].doc);
-    assertEquals(0, hits[1].doc);
+    Assert.assertEquals(1, hits[0].doc);
+    Assert.assertEquals(0, hits[1].doc);
     assertTrue(hits[0].score > hits[1].score);
 
     q1 = csrq("data", "A", "A", T, T); // matches document #0
@@ -234,11 +247,12 @@ public class TestMultiTermConstantScore 
     bq.add(q2, BooleanClause.Occur.SHOULD);
 
     hits = search.search(bq, null, 1000).scoreDocs;
-    assertEquals(0, hits[0].doc);
-    assertEquals(1, hits[1].doc);
+    Assert.assertEquals(0, hits[0].doc);
+    Assert.assertEquals(1, hits[1].doc);
     assertTrue(hits[0].score > hits[1].score);
   }
 
+  @Test
   public void testBooleanOrderUnAffected() throws IOException {
     // NOTE: uses index build in *this* setUp
 
@@ -269,6 +283,7 @@ public class TestMultiTermConstantScore 
 
   }
 
+  @Test
   public void testRangeQueryId() throws IOException {
     // NOTE: uses index build in *super* setUp
 
@@ -396,6 +411,7 @@ public class TestMultiTermConstantScore 
     assertEquals("med,med,T,T", 1, result.length);
   }
 
+  @Test
   public void testRangeQueryIdCollating() throws IOException {
     // NOTE: uses index build in *super* setUp
 
@@ -479,6 +495,7 @@ public class TestMultiTermConstantScore 
     assertEquals("med,med,T,T,c", 1, result.length);
   }
 
+  @Test
   public void testRangeQueryRand() throws IOException {
     // NOTE: uses index build in *super* setUp
 
@@ -541,6 +558,7 @@ public class TestMultiTermConstantScore 
 
   }
 
+  @Test
   public void testRangeQueryRandCollating() throws IOException {
     // NOTE: uses index build in *super* setUp
 
@@ -605,6 +623,7 @@ public class TestMultiTermConstantScore 
     assertEquals("max,nul,T,T,c", 1, result.length);
   }
 
+  @Test
   public void testFarsi() throws Exception {
 
     /* build an index */
@@ -645,6 +664,7 @@ public class TestMultiTermConstantScore 
     farsiIndex.close();
   }
 
+  @Test
   public void testDanish() throws Exception {
 
     /* build an index */

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java Sun Sep 12 18:28:10 2010
@@ -21,6 +21,7 @@ import java.util.Locale;
 import java.text.DecimalFormat;
 import java.text.DecimalFormatSymbols;
 
+import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.document.NumericField;
@@ -28,6 +29,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
 
 public class TestMultiValuedNumericRangeQuery extends LuceneTestCase {
 
@@ -38,7 +40,9 @@ public class TestMultiValuedNumericRange
    */
   public void testMultiValuedNRQ() throws Exception {
     Directory directory = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, directory);
+    RandomIndexWriter writer = new RandomIndexWriter(random, directory,
+        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     DecimalFormat format = new DecimalFormat("00000000000", new DecimalFormatSymbols(Locale.US));
     

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java Sun Sep 12 18:28:10 2010
@@ -31,6 +31,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCaseJ4;
 import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util._TestUtil;
 
 import org.junit.Test;
 import org.junit.AfterClass;
@@ -54,7 +55,9 @@ public class TestNumericRangeQuery32 ext
   public static void beforeClass() throws Exception {
     random = newStaticRandom(TestNumericRangeQuery32.class);
     directory = newDirectory(random);
-    RandomIndexWriter writer = new RandomIndexWriter(random, directory);
+    RandomIndexWriter writer = new RandomIndexWriter(random, directory,
+        newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     NumericField
       field8 = new NumericField("field8", 8, Field.Store.YES, true),

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java Sun Sep 12 18:28:10 2010
@@ -30,6 +30,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCaseJ4;
 import org.apache.lucene.util.NumericUtils;
+import org.apache.lucene.util._TestUtil;
 
 import org.junit.Test;
 import org.junit.AfterClass;
@@ -53,7 +54,9 @@ public class TestNumericRangeQuery64 ext
   public static void beforeClass() throws Exception {
     random = newStaticRandom(TestNumericRangeQuery64.class);
     directory = newDirectory(random);
-    RandomIndexWriter writer = new RandomIndexWriter(random, directory);
+    RandomIndexWriter writer = new RandomIndexWriter(random, directory,
+        newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     NumericField
       field8 = new NumericField("field8", 8, Field.Store.YES, true),

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java Sun Sep 12 18:28:10 2010
@@ -27,6 +27,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
@@ -45,13 +46,18 @@ public class TestPrefixRandom extends Lu
   protected void setUp() throws Exception {
     super.setUp();
     dir = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, dir, new MockAnalyzer(MockTokenizer.KEYWORD, false));
+    RandomIndexWriter writer = new RandomIndexWriter(random, dir, 
+        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.KEYWORD, false))
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     Document doc = new Document();
     Field field = newField("field", "", Field.Store.NO, Field.Index.NOT_ANALYZED);
     doc.add(field);
 
-    int num = 2000 * RANDOM_MULTIPLIER;
+    // we generate aweful prefixes: good for testing.
+    // but for preflex codec, the test can be very slow, so use less iterations.
+    String codec = CodecProvider.getDefaultCodec();
+    int num = codec.equals("PreFlex") ? 200 * RANDOM_MULTIPLIER : 2000 * RANDOM_MULTIPLIER;
     for (int i = 0; i < num; i++) {
       field.setValue(_TestUtil.randomUnicodeString(random, 10));
       writer.addDocument(doc);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java Sun Sep 12 18:28:10 2010
@@ -22,6 +22,7 @@ import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
 import java.util.Locale;
 
+import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
@@ -29,6 +30,7 @@ import org.apache.lucene.index.RandomInd
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
 
 /**
  * Create an index with terms from 0000-9999.
@@ -44,7 +46,9 @@ public class TestRegexpRandom extends Lu
   protected void setUp() throws Exception {
     super.setUp();
     dir = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, dir);
+    RandomIndexWriter writer = new RandomIndexWriter(random, dir,
+        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     Document doc = new Document();
     Field field = newField("field", "", Field.Store.NO, Field.Index.ANALYZED);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java Sun Sep 12 18:28:10 2010
@@ -30,6 +30,7 @@ import org.apache.lucene.index.IndexRead
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.index.RandomIndexWriter;
+import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
@@ -53,7 +54,9 @@ public class TestRegexpRandom2 extends L
   protected void setUp() throws Exception {
     super.setUp();
     dir = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, dir, new MockAnalyzer(MockTokenizer.KEYWORD, false));
+    RandomIndexWriter writer = new RandomIndexWriter(random, dir, 
+        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.KEYWORD, false))
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     Document doc = new Document();
     Field field = newField("field", "", Field.Store.NO, Field.Index.NOT_ANALYZED);
@@ -129,8 +132,10 @@ public class TestRegexpRandom2 extends L
   
   /** test a bunch of random regular expressions */
   public void testRegexps() throws Exception {
-
-    int num = 1000 * RANDOM_MULTIPLIER;
+    // we generate aweful regexps: good for testing.
+    // but for preflex codec, the test can be very slow, so use less iterations.
+    String codec = CodecProvider.getDefaultCodec();
+    int num = codec.equals("PreFlex") ? 100 * RANDOM_MULTIPLIER : 1000 * RANDOM_MULTIPLIER;
     for (int i = 0; i < num; i++) {
       String reg = AutomatonTestUtil.randomRegexp(random).toString();
       assertSame(reg);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java Sun Sep 12 18:28:10 2010
@@ -27,6 +27,9 @@ import org.apache.lucene.index.Term;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.store.Directory;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * A basic 'positive' Unit test class for the TermRangeFilter class.
@@ -39,6 +42,7 @@ import org.apache.lucene.store.Directory
  */
 public class TestTermRangeFilter extends BaseTestRangeFilter {
   
+  @Test
   public void testRangeFilterId() throws IOException {
     
     IndexReader reader = signedIndexReader;
@@ -141,6 +145,7 @@ public class TestTermRangeFilter extends
     
   }
   
+  @Test
   public void testRangeFilterIdCollating() throws IOException {
     
     IndexReader reader = signedIndexReader;
@@ -242,6 +247,7 @@ public class TestTermRangeFilter extends
     assertEquals("med,med,T,T", 1, numHits);
   }
   
+  @Test
   public void testRangeFilterRand() throws IOException {
     
     IndexReader reader = signedIndexReader;
@@ -318,6 +324,7 @@ public class TestTermRangeFilter extends
     
   }
   
+  @Test
   public void testRangeFilterRandCollating() throws IOException {
     
     // using the unsigned index because collation seems to ignore hyphens
@@ -395,6 +402,7 @@ public class TestTermRangeFilter extends
     assertEquals("max,nul,T,T", 1, numHits);
   }
   
+  @Test
   public void testFarsi() throws Exception {
     
     /* build an index */
@@ -435,6 +443,7 @@ public class TestTermRangeFilter extends
     farsiIndex.close();
   }
   
+  @Test
   public void testDanish() throws Exception {
     
     /* build an index */

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java Sun Sep 12 18:28:10 2010
@@ -22,6 +22,7 @@ import java.text.DecimalFormatSymbols;
 import java.text.NumberFormat;
 import java.util.Locale;
 
+import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
@@ -29,6 +30,7 @@ import org.apache.lucene.index.RandomInd
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util._TestUtil;
 
 /**
  * Create an index with terms from 0000-9999.
@@ -44,7 +46,9 @@ public class TestWildcardRandom extends 
   protected void setUp() throws Exception {
     super.setUp();
     dir = newDirectory();
-    RandomIndexWriter writer = new RandomIndexWriter(random, dir);
+    RandomIndexWriter writer = new RandomIndexWriter(random, dir,
+        newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer())
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     
     Document doc = new Document();
     Field field = newField("field", "", Field.Store.NO, Field.Index.ANALYZED);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java?rev=996357&r1=996356&r2=996357&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java Sun Sep 12 18:28:10 2010
@@ -18,6 +18,7 @@ package org.apache.lucene.search.spans;
  */
 
 import java.io.IOException;
+import java.util.Random;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenizer;
@@ -37,7 +38,13 @@ import org.apache.lucene.search.QueryUti
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.English;
-import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.LuceneTestCaseJ4;
+import org.apache.lucene.util._TestUtil;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+import static org.junit.Assert.*;
 
 /**
  * Tests basic search capabilities.
@@ -51,21 +58,22 @@ import org.apache.lucene.util.LuceneTest
  * testing of the indexing and search code.
  *
  */
-public class TestBasics extends LuceneTestCase {
-  private IndexSearcher searcher;
-  private IndexReader reader;
-  private Directory directory;
-
-  @Override
-  protected void setUp() throws Exception {
-    super.setUp();
-    directory = newDirectory();
+public class TestBasics extends LuceneTestCaseJ4 {
+  private static IndexSearcher searcher;
+  private static IndexReader reader;
+  private static Directory directory;
+
+  @BeforeClass
+  public static void beforeClass() throws Exception {
+    Random random = newStaticRandom(TestBasics.class);
+    directory = newDirectory(random);
     RandomIndexWriter writer = new RandomIndexWriter(random, directory, 
-        new MockAnalyzer(MockTokenizer.SIMPLE, true));
+        newIndexWriterConfig(random, TEST_VERSION_CURRENT, new MockAnalyzer(MockTokenizer.SIMPLE, true))
+        .setMaxBufferedDocs(_TestUtil.nextInt(random, 50, 1000)));
     //writer.infoStream = System.out;
     for (int i = 0; i < 1000; i++) {
       Document doc = new Document();
-      doc.add(newField("field", English.intToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
+      doc.add(newField(random, "field", English.intToEnglish(i), Field.Store.YES, Field.Index.ANALYZED));
       writer.addDocument(doc);
     }
     reader = writer.getReader();
@@ -73,15 +81,17 @@ public class TestBasics extends LuceneTe
     writer.close();
   }
 
-  @Override
-  protected void tearDown() throws Exception {
+  @AfterClass
+  public static void afterClass() throws Exception {
     searcher.close();
     reader.close();
     directory.close();
-    super.tearDown();
+    searcher = null;
+    reader = null;
+    directory = null;
   }
 
-
+  @Test
   public void testTerm() throws Exception {
     Query query = new TermQuery(new Term("field", "seventy"));
     checkHits(query, new int[]
@@ -94,11 +104,13 @@ public class TestBasics extends LuceneTe
        876, 877, 878, 879, 970, 971, 972, 973, 974, 975, 976, 977, 978, 979});
     }
 
+  @Test
   public void testTerm2() throws Exception {
     Query query = new TermQuery(new Term("field", "seventish"));
     checkHits(query, new int[] {});
   }
 
+  @Test
   public void testPhrase() throws Exception {
     PhraseQuery query = new PhraseQuery();
     query.add(new Term("field", "seventy"));
@@ -107,6 +119,7 @@ public class TestBasics extends LuceneTe
       {77, 177, 277, 377, 477, 577, 677, 777, 877, 977});
   }
 
+  @Test
   public void testPhrase2() throws Exception {
     PhraseQuery query = new PhraseQuery();
     query.add(new Term("field", "seventish"));
@@ -114,6 +127,7 @@ public class TestBasics extends LuceneTe
     checkHits(query, new int[] {});
   }
 
+  @Test
   public void testBoolean() throws Exception {
     BooleanQuery query = new BooleanQuery();
     query.add(new TermQuery(new Term("field", "seventy")), BooleanClause.Occur.MUST);
@@ -123,6 +137,7 @@ public class TestBasics extends LuceneTe
        776, 778, 779, 877, 977});
   }
 
+  @Test
   public void testBoolean2() throws Exception {
     BooleanQuery query = new BooleanQuery();
     query.add(new TermQuery(new Term("field", "sevento")), BooleanClause.Occur.MUST);
@@ -130,6 +145,7 @@ public class TestBasics extends LuceneTe
     checkHits(query, new int[] {});
   }
 
+  @Test
   public void testSpanNearExact() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "seventy"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "seven"));
@@ -146,6 +162,7 @@ public class TestBasics extends LuceneTe
     QueryUtils.checkUnequal(term1,term2);
   }
 
+  @Test
   public void testSpanNearUnordered() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "nine"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "six"));
@@ -157,6 +174,7 @@ public class TestBasics extends LuceneTe
        906, 926, 936, 946, 956, 966, 976, 986, 996});
   }
 
+  @Test
   public void testSpanNearOrdered() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "nine"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "six"));
@@ -166,6 +184,7 @@ public class TestBasics extends LuceneTe
       {906, 926, 936, 946, 956, 966, 976, 986, 996});
   }
 
+  @Test
   public void testSpanNot() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
@@ -181,6 +200,7 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
   }
   
+  @Test
   public void testSpanWithMultipleNotSingle() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
@@ -199,6 +219,7 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
   }
 
+  @Test
   public void testSpanWithMultipleNotMany() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
@@ -218,7 +239,8 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 801).getValue() > 0.0f);
     assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
   }
-    
+
+  @Test
   public void testNpeInSpanNearWithSpanNot() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "eight"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "one"));
@@ -238,7 +260,7 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 891).getValue() > 0.0f);
   }
 
-  
+  @Test
   public void testNpeInSpanNearInSpanFirstInSpanNot() throws Exception {
     int n = 5;
     SpanTermQuery hun = new SpanTermQuery(new Term("field", "hundred"));
@@ -255,6 +277,7 @@ public class TestBasics extends LuceneTe
     
   }
   
+  @Test
   public void testSpanFirst() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "five"));
     SpanFirstQuery query = new SpanFirstQuery(term1, 1);
@@ -274,6 +297,7 @@ public class TestBasics extends LuceneTe
 
   }
 
+  @Test
   public void testSpanOr() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "thirty"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "three"));
@@ -294,6 +318,7 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 947).getValue() > 0.0f);
   }
 
+  @Test
   public void testSpanExactNested() throws Exception {
     SpanTermQuery term1 = new SpanTermQuery(new Term("field", "three"));
     SpanTermQuery term2 = new SpanTermQuery(new Term("field", "hundred"));
@@ -312,6 +337,7 @@ public class TestBasics extends LuceneTe
     assertTrue(searcher.explain(query, 333).getValue() > 0.0f);
   }
 
+  @Test
   public void testSpanNearOr() throws Exception {
 
     SpanTermQuery t1 = new SpanTermQuery(new Term("field","six"));
@@ -333,6 +359,7 @@ public class TestBasics extends LuceneTe
        756, 757, 766, 767, 776, 777, 786, 787, 796, 797});
   }
 
+  @Test
   public void testSpanComplex1() throws Exception {
       
     SpanTermQuery t1 = new SpanTermQuery(new Term("field","six"));
@@ -359,6 +386,7 @@ public class TestBasics extends LuceneTe
        756, 757, 766, 767, 776, 777, 786, 787, 796, 797});
   }
   
+  @Test
   public void testSpansSkipTo() throws Exception {
 	  SpanTermQuery t1 = new SpanTermQuery(new Term("field", "seventy"));
 	  SpanTermQuery t2 = new SpanTermQuery(new Term("field", "seventy"));



Mime
View raw message