lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: svn commit: r1211867 - /lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/TestSizeBoundedForceMerge.java
Date Thu, 08 Dec 2011 16:08:37 GMT
Thank you! Fantastic - now we need the same for TestAddIndexes! :-)

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: rmuir@apache.org [mailto:rmuir@apache.org]
> Sent: Thursday, December 08, 2011 2:20 PM
> To: commits@lucene.apache.org
> Subject: svn commit: r1211867 -
> /lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/T
> estSizeBoundedForceMerge.java
> 
> Author: rmuir
> Date: Thu Dec  8 13:19:32 2011
> New Revision: 1211867
> 
> URL: http://svn.apache.org/viewvc?rev=1211867&view=rev
> Log:
> LUCENE-3606: fix test
> 
> Modified:
> 
> lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/Te
> stSizeBoundedForceMerge.java
> 
> Modified:
> lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/Te
> stSizeBoundedForceMerge.java
> URL:
> http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/test
> /org/apache/lucene/index/TestSizeBoundedForceMerge.java?rev=1211867&r1
> =1211866&r2=1211867&view=diff
> ================================================================
> ==============
> ---
> lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/index/Te
> stSizeBoundedForceMerge.java (original)
> +++ lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/ind
> +++ ex/TestSizeBoundedForceMerge.java Thu Dec  8 13:19:32 2011
> @@ -20,6 +20,8 @@ package org.apache.lucene.index;  import
> java.io.IOException;
> 
>  import org.apache.lucene.document.Document;
> +import org.apache.lucene.document.Field; import
> +org.apache.lucene.document.StringField;
>  import org.apache.lucene.store.Directory;
>  import org.apache.lucene.store.RAMDirectory;
>  import org.apache.lucene.util.LuceneTestCase;
> @@ -27,8 +29,15 @@ import org.apache.lucene.util.LuceneTest  public class
> TestSizeBoundedForceMerge extends LuceneTestCase {
> 
>    private void addDocs(IndexWriter writer, int numDocs) throws IOException {
> +    addDocs(writer, numDocs, false);
> +  }
> +
> +  private void addDocs(IndexWriter writer, int numDocs, boolean withID)
> + throws IOException {
>      for (int i = 0; i < numDocs; i++) {
>        Document doc = new Document();
> +      if (withID) {
> +        doc.add(new Field("id", "" + i, StringField.TYPE_UNSTORED));
> +      }
>        writer.addDocument(doc);
>      }
>      writer.commit();
> @@ -276,7 +285,6 @@ public class TestSizeBoundedForceMerge e
>      assertEquals(4, sis.size());
>    }
> 
> -  /* nocommit: Fix tests to use an id and delete by term
>    public void testSingleMergeableSegment() throws Exception {
>      Directory dir = new RAMDirectory();
> 
> @@ -287,12 +295,9 @@ public class TestSizeBoundedForceMerge e
>      addDocs(writer, 5);
>      addDocs(writer, 3);
> 
> -    writer.close();
> -
>      // delete the last document, so that the last segment is merged.
> -    IndexReader r = IndexReader.open(dir);
> -    r.deleteDocument(r.numDocs() - 1);
> -    r.close();
> +    writer.deleteDocuments(new Term("id", "10"));
> +    writer.close();
> 
>      conf = newWriterConfig();
>      LogMergePolicy lmp = new LogDocMergePolicy(); @@ -309,7 +314,6 @@
> public class TestSizeBoundedForceMerge e
>      assertEquals(3, sis.size());
>      assertFalse(sis.info(2).hasDeletions());
>    }
> -  */
> 
>    public void testSingleNonMergeableSegment() throws Exception {
>      Directory dir = new RAMDirectory(); @@ -317,7 +321,7 @@ public class
> TestSizeBoundedForceMerge e
>      IndexWriterConfig conf = newWriterConfig();
>      IndexWriter writer = new IndexWriter(dir, conf);
> 
> -    addDocs(writer, 3);
> +    addDocs(writer, 3, true);
> 
>      writer.close();
> 
> @@ -336,21 +340,18 @@ public class TestSizeBoundedForceMerge e
>      assertEquals(1, sis.size());
>    }
> 
> -  /* nocommit: Fix tests to use an id and delete by term
>    public void testSingleMergeableTooLargeSegment() throws Exception {
>      Directory dir = new RAMDirectory();
> 
>      IndexWriterConfig conf = newWriterConfig();
>      IndexWriter writer = new IndexWriter(dir, conf);
> 
> -    addDocs(writer, 5);
> +    addDocs(writer, 5, true);
> 
> -    writer.close();
> -
>      // delete the last document
> -    IndexReader r = IndexReader.open(dir);
> -    r.deleteDocument(r.numDocs() - 1);
> -    r.close();
> +
> +    writer.deleteDocuments(new Term("id", "4"));
> +    writer.close();
> 
>      conf = newWriterConfig();
>      LogMergePolicy lmp = new LogDocMergePolicy(); @@ -367,6 +368,5 @@
> public class TestSizeBoundedForceMerge e
>      assertEquals(1, sis.size());
>      assertTrue(sis.info(0).hasDeletions());
>    }
> -  */
> 
>  }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: dev-help@lucene.apache.org


Mime
View raw message