lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ar...@apache.org
Subject svn commit: r1671187 - /lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java
Date Fri, 03 Apr 2015 22:26:43 GMT
Author: areek
Date: Fri Apr  3 22:26:42 2015
New Revision: 1671187

URL: http://svn.apache.org/r1671187
Log:
LUCENE-6339: fix test (ensure the maximum requested size is bounded to 1000)

Modified:
    lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java

Modified: lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java?rev=1671187&r1=1671186&r2=1671187&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java
(original)
+++ lucene/dev/branches/branch_5x/lucene/suggest/src/test/org/apache/lucene/search/suggest/document/SuggestFieldTest.java
Fri Apr  3 22:26:42 2015
@@ -27,6 +27,7 @@ import java.util.Set;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CyclicBarrier;
 
+import com.carrotsearch.randomizedtesting.annotations.Seed;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.analysis.MockTokenFilter;
@@ -147,7 +148,7 @@ public class SuggestFieldTest extends Lu
   public void testDupSuggestFieldValues() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
-    int num = atLeast(300);
+    int num = Math.min(1000, atLeast(300));
     long[] weights = new long[num];
     for(int i = 0; i < num; i++) {
       Document document = new Document();
@@ -180,7 +181,7 @@ public class SuggestFieldTest extends Lu
     // using IndexWriter instead of RandomIndexWriter
     IndexWriter iw = new IndexWriter(dir, iwcWithSuggestField(analyzer, "suggest_field"));
 
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
 
     Document document = new Document();
     int numLive = 0;
@@ -217,7 +218,7 @@ public class SuggestFieldTest extends Lu
   public void testSuggestOnAllFilteredDocuments() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     for (int i = 0; i < num; i++) {
       Document document = new Document();
       document.add(newSuggestField("suggest_field", "abc_" + i, i));
@@ -246,7 +247,7 @@ public class SuggestFieldTest extends Lu
     Analyzer analyzer = new MockAnalyzer(random());
     // using IndexWriter instead of RandomIndexWriter
     IndexWriter iw = new IndexWriter(dir, iwcWithSuggestField(analyzer, "suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     for (int i = 0; i < num; i++) {
       Document document = new Document();
       document.add(newSuggestField("suggest_field", "abc_" + i, i));
@@ -274,7 +275,7 @@ public class SuggestFieldTest extends Lu
     Analyzer analyzer = new MockAnalyzer(random());
     // using IndexWriter instead of RandomIndexWriter
     IndexWriter iw = new IndexWriter(dir, iwcWithSuggestField(analyzer, "suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     for (int i = 1; i <= num; i++) {
       Document document = new Document();
       document.add(newSuggestField("suggest_field", "abc_" + i, i));
@@ -300,7 +301,7 @@ public class SuggestFieldTest extends Lu
   public void testSuggestOnMostlyFilteredOutDocuments() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     for (int i = 0; i < num; i++) {
       Document document = new Document();
       document.add(newSuggestField("suggest_field", "abc_" + i, i));
@@ -344,7 +345,7 @@ public class SuggestFieldTest extends Lu
   public void testEarlyTermination() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
 
     // have segments of 4 documents
     // with descending suggestion weights
@@ -371,7 +372,7 @@ public class SuggestFieldTest extends Lu
   public void testMultipleSegments() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     List<Entry> entries = new ArrayList<>();
 
     // ensure at least some segments have no suggest field
@@ -442,7 +443,7 @@ public class SuggestFieldTest extends Lu
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
 
-    int num = atLeast(10);
+    int num = Math.min(1000, atLeast(10));
     for (int i = 0; i < num; i++) {
       Document document = new Document();
       document.add(newSuggestField("suggest_field", "abc_" + i, num));
@@ -540,7 +541,7 @@ public class SuggestFieldTest extends Lu
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
 
-    int num = atLeast(100);
+    int num = Math.min(1000, atLeast(10));
     String[] prefixes = {"abc", "bac", "cab"};
     Map<String, Long> mappings = new HashMap<>();
     for (int i = 0; i < num; i++) {
@@ -581,7 +582,7 @@ public class SuggestFieldTest extends Lu
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field"));
     LineFileDocs lineFileDocs = new LineFileDocs(random());
-    int num = atLeast(100);
+    int num = Math.min(1000, atLeast(10));
     Map<String, Long> mappings = new HashMap<>();
     for (int i = 0; i < num; i++) {
       Document document = lineFileDocs.nextDoc();
@@ -626,7 +627,7 @@ public class SuggestFieldTest extends Lu
   public void testThreads() throws Exception {
     Analyzer analyzer = new MockAnalyzer(random());
     RandomIndexWriter iw = new RandomIndexWriter(random(), dir, iwcWithSuggestField(analyzer,
"suggest_field_1", "suggest_field_2", "suggest_field_3"));
-    final int num = atLeast(100);
+    final int num = Math.min(1000, atLeast(10));
     final String prefix1 = "abc1_";
     final String prefix2 = "abc2_";
     final String prefix3 = "abc3_";



Mime
View raw message