You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2012/07/31 13:17:14 UTC

svn commit: r1367496 - in /lucene/dev/trunk: ./ lucene/ lucene/core/ lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java

Author: mikemccand
Date: Tue Jul 31 11:17:14 2012
New Revision: 1367496

URL: http://svn.apache.org/viewvc?rev=1367496&view=rev
Log:
use less RAM in this test

Modified:
    lucene/dev/trunk/   (props changed)
    lucene/dev/trunk/lucene/   (props changed)
    lucene/dev/trunk/lucene/core/   (props changed)
    lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java

Modified: lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java?rev=1367496&r1=1367495&r2=1367496&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java (original)
+++ lucene/dev/trunk/lucene/core/src/test/org/apache/lucene/index/TestPostingsFormat.java Tue Jul 31 11:17:14 2012
@@ -115,7 +115,7 @@ public class TestPostingsFormat extends 
     int endOffset;
   }
 
-  private static class Posting implements Comparable<Posting>{
+  private static class Posting implements Comparable<Posting> {
     int docID;
     List<Position> positions;
 
@@ -179,26 +179,27 @@ public class TestPostingsFormat extends 
         seenTerms.add(term);
 
         int numDocs;
-        if (random().nextInt(10) == 3 && numBigTerms < 3) {
+        if (random().nextInt(10) == 3 && numBigTerms < 2) {
           // 10% of the time make a highish freq term:
-          numDocs = _TestUtil.nextInt(random(), 50000, 70000);
+          numDocs = RANDOM_MULTIPLIER * _TestUtil.nextInt(random(), 50000, 70000);
           numBigTerms++;
           term = "big_" + term;
-        } else if (random().nextInt(10) == 3 && numMediumTerms < 10) {
+        } else if (random().nextInt(10) == 3 && numMediumTerms < 5) {
           // 10% of the time make a medium freq term:
           // TODO not high enough to test level 1 skipping:
-          numDocs = atLeast(3000);
+          numDocs = RANDOM_MULTIPLIER * _TestUtil.nextInt(random(), 3000, 6000);
           numMediumTerms++;
           term = "medium_" + term;
-        } else {
+        } else if (random().nextBoolean()) {
           // Low freq term:
-          numDocs = _TestUtil.nextInt(random(), 1, 40);
+          numDocs = RANDOM_MULTIPLIER * _TestUtil.nextInt(random(), 1, 40);
           term = "low_" + term;
+        } else {
+          // Very low freq term (don't multiply by RANDOM_MULTIPLIER):
+          numDocs = _TestUtil.nextInt(random(), 1, 3);
+          term = "verylow_" + term;
         }
 
-        // TODO: reduce the ram usage of this test so we can safely do this
-        // numDocs *= RANDOM_MULTIPLIER;
-
         List<Posting> termPostings = new ArrayList<Posting>();
         postings.put(new BytesRef(term), termPostings);
 
@@ -519,7 +520,7 @@ public class TestPostingsFormat extends 
       maxIndexOptions.compareTo(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS) >= 0;
     boolean doCheckOffsets = allowOffsets && random().nextInt(3) <= 2;
 
-    boolean doCheckPayloads = options.contains(Option.PAYLOADS) && allowPositions && fieldInfo.hasPayloads() && random().nextInt(3) <= 2;;
+    boolean doCheckPayloads = options.contains(Option.PAYLOADS) && allowPositions && fieldInfo.hasPayloads() && random().nextInt(3) <= 2;
 
     DocsEnum prevDocsEnum = null;