lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1044113 - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/src/test/org/apache/lucene/index/ lucene/src/test/org/apache/lucene/util/ solr/
Date Thu, 09 Dec 2010 19:56:52 GMT
Author: mikemccand
Date: Thu Dec  9 19:56:51 2010
New Revision: 1044113

URL: http://svn.apache.org/viewvc?rev=1044113&view=rev
Log:
LUCENE-2768: add line docs file so tests can easily run for longer on real data; add threaded
NRT stress test

Added:
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
      - copied, changed from r1044098, lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LineFileDocs.java
      - copied unchanged from r1044098, lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LineFileDocs.java
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/europarl.lines.txt.gz
      - copied unchanged from r1044098, lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/europarl.lines.txt.gz
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/makeEuroparlLineFile.py
      - copied unchanged from r1044098, lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/makeEuroparlLineFile.py
Modified:
    lucene/dev/branches/branch_3x/   (props changed)
    lucene/dev/branches/branch_3x/lucene/   (props changed)
    lucene/dev/branches/branch_3x/lucene/common-build.xml
    lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/branches/branch_3x/solr/   (props changed)

Modified: lucene/dev/branches/branch_3x/lucene/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/common-build.xml?rev=1044113&r1=1044112&r2=1044113&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/common-build.xml (original)
+++ lucene/dev/branches/branch_3x/lucene/common-build.xml Thu Dec  9 19:56:51 2010
@@ -67,6 +67,7 @@
   <property name="tests.locale" value="random" />
   <property name="tests.timezone" value="random" />
   <property name="tests.directory" value="random" />
+  <property name="tests.linedocsfile" value="europarl.lines.txt.gz" />
   <property name="tests.iter" value="1" />
   <property name="tests.seed" value="random" />
   <property name="tests.userdir" value="."/>
@@ -451,6 +452,8 @@
 	      <sysproperty key="tests.timezone" value="${tests.timezone}"/>
               <!-- set the directory tests should run with -->
               <sysproperty key="tests.directory" value="${tests.directory}"/>
+              <!-- set the line file source for oal.util.LineFileDocs -->
+              <sysproperty key="tests.linedocsfile" value="${tests.linedocsfile}"/>
               <!-- set the number of times tests should run -->
               <sysproperty key="tests.iter" value="${tests.iter}"/>
               <!-- set the test seed -->

Copied: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
(from r1044098, lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java?p2=lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java&p1=lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java&r1=1044098&r2=1044113&rev=1044113&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
Thu Dec  9 19:56:51 2010
@@ -27,7 +27,6 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
-import org.apache.lucene.index.codecs.CodecProvider;
 import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.PhraseQuery;
 import org.apache.lucene.search.Query;
@@ -36,8 +35,6 @@ import org.apache.lucene.search.SortFiel
 import org.apache.lucene.search.TermQuery;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.store.MockDirectoryWrapper;
-import org.apache.lucene.util.Bits;
-import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LineFileDocs;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util._TestUtil;
@@ -56,11 +53,6 @@ public class TestNRTThreads extends Luce
 
     final long t0 = System.currentTimeMillis();
 
-    if (CodecProvider.getDefault().getDefaultFieldCodec().equals("SimpleText")) {
-      // no
-      CodecProvider.getDefault().setDefaultFieldCodec("Standard");
-    }
-
     final LineFileDocs docs = new LineFileDocs(true);
     final File tempDir = _TestUtil.getTempDir("nrtopenfiles");
     final MockDirectoryWrapper dir = new MockDirectoryWrapper(random, FSDirectory.open(tempDir));
@@ -72,11 +64,10 @@ public class TestNRTThreads extends Luce
           System.out.println("TEST: now warm merged reader=" + reader);
         }
         final int maxDoc = reader.maxDoc();
-        final Bits delDocs = reader.getDeletedDocs();
         int sum = 0;
         final int inc = Math.max(1, maxDoc/50);
         for(int docID=0;docID<maxDoc;docID += inc) {
-          if (delDocs == null || !delDocs.get(docID)) {
+          if (reader.isDeleted(docID)) {
             final Document doc = reader.document(docID);
             sum += doc.getFields().size();
           }
@@ -175,7 +166,7 @@ public class TestNRTThreads extends Luce
     // let index build up a bit
     Thread.sleep(100);
 
-    IndexReader r = IndexReader.open(writer);
+    IndexReader r = writer.getReader();
     boolean any = false;
 
     // silly starting guess:
@@ -206,7 +197,7 @@ public class TestNRTThreads extends Luce
         if (VERBOSE) {
           System.out.println("TEST: now open");
         }
-        r = IndexReader.open(writer);
+        r = writer.getReader();
       }
       if (VERBOSE) {
         System.out.println("TEST: got new reader=" + r);
@@ -227,7 +218,7 @@ public class TestNRTThreads extends Luce
           @Override
           public void run() {
             try {
-              TermsEnum termsEnum = MultiFields.getTerms(s.getIndexReader(), "body").iterator();
+              TermEnum termEnum = s.getIndexReader().terms(new Term("body", ""));
               int seenTermCount = 0;
               int shift;
               int trigger;
@@ -239,14 +230,14 @@ public class TestNRTThreads extends Luce
                 trigger = totTermCount.get()/10;
               }
               while(System.currentTimeMillis() < searchStopTime) {
-                BytesRef term = termsEnum.next();
+                Term term = termEnum.term();
                 if (term == null) {
                   totTermCount.set(seenTermCount);
                   seenTermCount = 0;
                   trigger = totTermCount.get()/10;
                   //System.out.println("trigger " + trigger);
                   shift = random.nextInt(totTermCount.get()/10);
-                  termsEnum.seek(new BytesRef(""));
+                  termEnum = s.getIndexReader().terms(new Term("body", ""));
                   continue;
                 }
                 seenTermCount++;
@@ -258,7 +249,7 @@ public class TestNRTThreads extends Luce
                   //if (VERBOSE) {
                   //System.out.println(Thread.currentThread().getName() + " now search body:"
+ term.utf8ToString());
                   //}
-                  totHits.addAndGet(runQuery(s, new TermQuery(new Term("body", term))));
+                  totHits.addAndGet(runQuery(s, new TermQuery(term)));
                 }
               }
               if (VERBOSE) {

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java?rev=1044113&r1=1044112&r2=1044113&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
(original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
Thu Dec  9 19:56:51 2010
@@ -137,17 +137,19 @@ public abstract class LuceneTestCase ext
   // each test case (non-J4 tests) and each test class (J4
   // tests)
   /** Gets the locale to run tests with */
-  static final String TEST_LOCALE = System.getProperty("tests.locale", "random");
+  public static final String TEST_LOCALE = System.getProperty("tests.locale", "random");
   /** Gets the timezone to run tests with */
-  static final String TEST_TIMEZONE = System.getProperty("tests.timezone", "random");
+  public static final String TEST_TIMEZONE = System.getProperty("tests.timezone", "random");
   /** Gets the directory to run tests with */
-  static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random");
+  public static final String TEST_DIRECTORY = System.getProperty("tests.directory", "random");
   /** Get the number of times to run tests */
-  static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1"));
+  public static final int TEST_ITER = Integer.parseInt(System.getProperty("tests.iter", "1"));
   /** Get the random seed for tests */
-  static final String TEST_SEED = System.getProperty("tests.seed", "random");
+  public static final String TEST_SEED = System.getProperty("tests.seed", "random");
   /** whether or not nightly tests should run */
-  static final boolean TEST_NIGHTLY = Boolean.parseBoolean(System.getProperty("tests.nightly",
"false"));
+  public static final boolean TEST_NIGHTLY = Boolean.parseBoolean(System.getProperty("tests.nightly",
"false"));
+  /** the line file used by LineFileDocs */
+  public static final String TEST_LINE_DOCS_FILE = System.getProperty("tests.linedocsfile",
"europarl.lines.txt.gz");
   
   /**
    * A random multiplier which you should use when writing random tests:



Mime
View raw message