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/11/05 18:36:16 UTC

svn commit: r1405891 - /lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java

Author: mikemccand
Date: Mon Nov  5 17:36:16 2012
New Revision: 1405891

URL: http://svn.apache.org/viewvc?rev=1405891&view=rev
Log:
use smaller index for TestSlowCollationMethods.testQuery

Modified:
    lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java

Modified: lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java?rev=1405891&r1=1405890&r2=1405891&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java (original)
+++ lucene/dev/branches/branch_4x/lucene/sandbox/src/test/org/apache/lucene/sandbox/queries/TestSlowCollationMethods.java Mon Nov  5 17:36:16 2012
@@ -147,10 +147,40 @@ public class TestSlowCollationMethods ex
     }
   }
   
-  public void testQuery() {
+  public void testQuery() throws Exception {
+
+    // Copied from beforeClass, but scaled down to few docs:
+    // since otherwise this test can run for a very long
+    // time (1-2 hours or more; see Lucene-Solr-4.x-Linux Build #2204):
+    final Locale locale = LuceneTestCase.randomLocale(random());
+    Collator collator = Collator.getInstance(locale);
+    collator.setStrength(Collator.IDENTICAL);
+    collator.setDecomposition(Collator.NO_DECOMPOSITION);
+
+    int numDocs = 20 * RANDOM_MULTIPLIER;
+    Directory dir = newDirectory();
+    RandomIndexWriter iw = new RandomIndexWriter(random(), dir);
+    for (int i = 0; i < numDocs; i++) {
+      Document doc = new Document();
+      String value = _TestUtil.randomUnicodeString(random());
+      Field field = newStringField("field", value, Field.Store.YES);
+      doc.add(field);
+      iw.addDocument(doc);
+    }
+    IndexReader reader = iw.getReader();
+    iw.close();
+
+    IndexSearcher searcher = newSearcher(reader);
+
     String startPoint = _TestUtil.randomUnicodeString(random());
     String endPoint = _TestUtil.randomUnicodeString(random());
     Query query = new SlowCollatedTermRangeQuery("field", startPoint, endPoint, true, true, collator);
     QueryUtils.check(random(), query, searcher);
+    reader.close();
+    dir.close();
+    collator = null;
+    searcher = null;
+    reader = null;
+    dir = null;
   }
 }