Re: svn commit: r822284 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

2009-10-06 Thread Michael McCandless
No problem!  It's exciting :)

Mike

On Tue, Oct 6, 2009 at 10:40 AM, Uwe Schindler  wrote:
> Thanks, sorry for extra work! I missed to do this after the svn copy :(
>
> -
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: u...@thetaphi.de
>
>
>> -Original Message-
>> From: Michael McCandless [mailto:luc...@mikemccandless.com]
>> Sent: Tuesday, October 06, 2009 4:37 PM
>> To: java-dev@lucene.apache.org
>> Subject: Re: svn commit: r822284 -
>> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
>> lity.java
>>
>> OK will do.
>>
>> Mike
>>
>> On Tue, Oct 6, 2009 at 10:23 AM, Uwe Schindler  wrote:
>> > Can you add this patch to backwards, too? I forgot, that some of the
>> > backwards-changes also applied to BW, but for completeness, not sure, if
>> a
>> > tag is also needed.
>> >
>> > -
>> > Uwe Schindler
>> > H.-H.-Meier-Allee 63, D-28213 Bremen
>> > http://www.thetaphi.de
>> > eMail: u...@thetaphi.de
>> >
>> >
>> >> -Original Message-
>> >> From: mikemcc...@apache.org [mailto:mikemcc...@apache.org]
>> >> Sent: Tuesday, October 06, 2009 4:13 PM
>> >> To: java-comm...@lucene.apache.org
>> >> Subject: svn commit: r822284 -
>> >>
>> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
>> >> lity.java
>> >>
>> >> Author: mikemccand
>> >> Date: Tue Oct  6 14:12:46 2009
>> >> New Revision: 822284
>> >>
>> >> URL: http://svn.apache.org/viewvc?rev=822284&view=rev
>> >> Log:
>> >> fix TestBackwardsCompability to not use deprecated APIs
>> >>
>> >> Modified:
>> >>
>> >>
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> >> ity.java
>> >>
>> >> Modified:
>> >>
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> >> ity.java
>> >> URL:
>> >>
>> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/
>> >>
>> index/TestBackwardsCompatibility.java?rev=822284&r1=822283&r2=822284&view=
>> >> diff
>> >>
>> ==
>> >> 
>> >> ---
>> >>
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> >> ity.java (original)
>> >> +++
>> >>
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> >> ity.java Tue Oct  6 14:12:46 2009
>> >> @@ -158,11 +158,7 @@
>> >>      for(int i=0;i> >>        String dirName = "src/test/org/apache/lucene/index/index." +
>> >> oldNames[i];
>> >>        unzip(dirName, oldNames[i]);
>> >> -      changeIndexNoAdds(oldNames[i], true);
>> >> -      rmDir(oldNames[i]);
>> >> -
>> >> -      unzip(dirName, oldNames[i]);
>> >> -      changeIndexNoAdds(oldNames[i], false);
>> >> +      changeIndexNoAdds(oldNames[i]);
>> >>        rmDir(oldNames[i]);
>> >>      }
>> >>    }
>> >> @@ -171,11 +167,7 @@
>> >>      for(int i=0;i> >>        String dirName = "src/test/org/apache/lucene/index/index." +
>> >> oldNames[i];
>> >>        unzip(dirName, oldNames[i]);
>> >> -      changeIndexWithAdds(oldNames[i], true);
>> >> -      rmDir(oldNames[i]);
>> >> -
>> >> -      unzip(dirName, oldNames[i]);
>> >> -      changeIndexWithAdds(oldNames[i], false);
>> >> +      changeIndexWithAdds(oldNames[i]);
>> >>        rmDir(oldNames[i]);
>> >>      }
>> >>    }
>> >> @@ -196,7 +188,7 @@
>> >>      dirName = fullDir(dirName);
>> >>
>> >>      Directory dir = FSDirectory.open(new File(dirName));
>> >> -    IndexSearcher searcher = new IndexSearcher(dir);
>> >> +    IndexSearcher searcher = new IndexSearcher(dir, true);
>> >>      IndexReader reader = searcher.getIndexReader();
>> >>
>> >>      _TestUtil.checkIndex(dir);
>> >> @@ -267,14 +259,14 @@
>> >>
>> >>    /* Open pre-lockless index, add docs, do a delete &
>> >>     * setNorm, and search */
>> >> -  public void changeIndexWithAdds(String dirName, boolean autoCommit)
>> >> throws IOException {
>> >> +  public void changeIndexWithAdds(String dirName) throws IOException {
>> >>      String origDirName = dirName;
>> >>      dirName = fullDir(dirName);
>> >>
>> >>      Directory dir = FSDirectory.open(new File(dirName));
>> >>
>> >>      // open writer
>> >> -    IndexWriter writer = new IndexWriter(dir, autoCommit, new
>> >> WhitespaceAnalyzer(), false);
>> >> +    IndexWriter writer = new IndexWriter(dir, new
>> WhitespaceAnalyzer(),
>> >> false, IndexWriter.MaxFieldLength.UNLIMITED);
>> >>
>> >>      // add 10 docs
>> >>      for(int i=0;i<10;i++) {
>> >> @@ -288,11 +280,11 @@
>> >>      } else {
>> >>        expected = 46;
>> >>      }
>> >> -    assertEquals("wrong doc count", expected, writer.docCount());
>> >> +    assertEquals("wrong doc count", expected, writer.maxDoc());
>> >>      writer.close();
>> >>
>> >>      // make sure searching sees right # hits
>> >> -    IndexSearcher searcher = new IndexSearcher(dir);
>> >> +    IndexSearcher searcher = new IndexSearcher(dir, true);
>> >>      ScoreDoc[] hits = searcher.search(new TermQuery(new
>> Term("content",
>> >> "aaa"))

RE: svn commit: r822284 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

2009-10-06 Thread Uwe Schindler
Thanks, sorry for extra work! I missed to do this after the svn copy :(

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


> -Original Message-
> From: Michael McCandless [mailto:luc...@mikemccandless.com]
> Sent: Tuesday, October 06, 2009 4:37 PM
> To: java-dev@lucene.apache.org
> Subject: Re: svn commit: r822284 -
> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
> lity.java
> 
> OK will do.
> 
> Mike
> 
> On Tue, Oct 6, 2009 at 10:23 AM, Uwe Schindler  wrote:
> > Can you add this patch to backwards, too? I forgot, that some of the
> > backwards-changes also applied to BW, but for completeness, not sure, if
> a
> > tag is also needed.
> >
> > -
> > Uwe Schindler
> > H.-H.-Meier-Allee 63, D-28213 Bremen
> > http://www.thetaphi.de
> > eMail: u...@thetaphi.de
> >
> >
> >> -Original Message-
> >> From: mikemcc...@apache.org [mailto:mikemcc...@apache.org]
> >> Sent: Tuesday, October 06, 2009 4:13 PM
> >> To: java-comm...@lucene.apache.org
> >> Subject: svn commit: r822284 -
> >>
> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
> >> lity.java
> >>
> >> Author: mikemccand
> >> Date: Tue Oct  6 14:12:46 2009
> >> New Revision: 822284
> >>
> >> URL: http://svn.apache.org/viewvc?rev=822284&view=rev
> >> Log:
> >> fix TestBackwardsCompability to not use deprecated APIs
> >>
> >> Modified:
> >>
> >>
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> >> ity.java
> >>
> >> Modified:
> >>
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> >> ity.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/
> >>
> index/TestBackwardsCompatibility.java?rev=822284&r1=822283&r2=822284&view=
> >> diff
> >>
> ==
> >> 
> >> ---
> >>
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> >> ity.java (original)
> >> +++
> >>
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> >> ity.java Tue Oct  6 14:12:46 2009
> >> @@ -158,11 +158,7 @@
> >>      for(int i=0;i >>        String dirName = "src/test/org/apache/lucene/index/index." +
> >> oldNames[i];
> >>        unzip(dirName, oldNames[i]);
> >> -      changeIndexNoAdds(oldNames[i], true);
> >> -      rmDir(oldNames[i]);
> >> -
> >> -      unzip(dirName, oldNames[i]);
> >> -      changeIndexNoAdds(oldNames[i], false);
> >> +      changeIndexNoAdds(oldNames[i]);
> >>        rmDir(oldNames[i]);
> >>      }
> >>    }
> >> @@ -171,11 +167,7 @@
> >>      for(int i=0;i >>        String dirName = "src/test/org/apache/lucene/index/index." +
> >> oldNames[i];
> >>        unzip(dirName, oldNames[i]);
> >> -      changeIndexWithAdds(oldNames[i], true);
> >> -      rmDir(oldNames[i]);
> >> -
> >> -      unzip(dirName, oldNames[i]);
> >> -      changeIndexWithAdds(oldNames[i], false);
> >> +      changeIndexWithAdds(oldNames[i]);
> >>        rmDir(oldNames[i]);
> >>      }
> >>    }
> >> @@ -196,7 +188,7 @@
> >>      dirName = fullDir(dirName);
> >>
> >>      Directory dir = FSDirectory.open(new File(dirName));
> >> -    IndexSearcher searcher = new IndexSearcher(dir);
> >> +    IndexSearcher searcher = new IndexSearcher(dir, true);
> >>      IndexReader reader = searcher.getIndexReader();
> >>
> >>      _TestUtil.checkIndex(dir);
> >> @@ -267,14 +259,14 @@
> >>
> >>    /* Open pre-lockless index, add docs, do a delete &
> >>     * setNorm, and search */
> >> -  public void changeIndexWithAdds(String dirName, boolean autoCommit)
> >> throws IOException {
> >> +  public void changeIndexWithAdds(String dirName) throws IOException {
> >>      String origDirName = dirName;
> >>      dirName = fullDir(dirName);
> >>
> >>      Directory dir = FSDirectory.open(new File(dirName));
> >>
> >>      // open writer
> >> -    IndexWriter writer = new IndexWriter(dir, autoCommit, new
> >> WhitespaceAnalyzer(), false);
> >> +    IndexWriter writer = new IndexWriter(dir, new
> WhitespaceAnalyzer(),
> >> false, IndexWriter.MaxFieldLength.UNLIMITED);
> >>
> >>      // add 10 docs
> >>      for(int i=0;i<10;i++) {
> >> @@ -288,11 +280,11 @@
> >>      } else {
> >>        expected = 46;
> >>      }
> >> -    assertEquals("wrong doc count", expected, writer.docCount());
> >> +    assertEquals("wrong doc count", expected, writer.maxDoc());
> >>      writer.close();
> >>
> >>      // make sure searching sees right # hits
> >> -    IndexSearcher searcher = new IndexSearcher(dir);
> >> +    IndexSearcher searcher = new IndexSearcher(dir, true);
> >>      ScoreDoc[] hits = searcher.search(new TermQuery(new
> Term("content",
> >> "aaa")), null, 1000).scoreDocs;
> >>      Document d = searcher.doc(hits[0].doc);
> >>      assertEquals("wrong first document", "21", d.get("id"));
> >> @@ -301,7 +293,7 @@
> >>
> >>      // make sure we can do delete & setNorm against this
> >>      

Re: svn commit: r822284 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

2009-10-06 Thread Michael McCandless
OK will do.

Mike

On Tue, Oct 6, 2009 at 10:23 AM, Uwe Schindler  wrote:
> Can you add this patch to backwards, too? I forgot, that some of the
> backwards-changes also applied to BW, but for completeness, not sure, if a
> tag is also needed.
>
> -
> Uwe Schindler
> H.-H.-Meier-Allee 63, D-28213 Bremen
> http://www.thetaphi.de
> eMail: u...@thetaphi.de
>
>
>> -Original Message-
>> From: mikemcc...@apache.org [mailto:mikemcc...@apache.org]
>> Sent: Tuesday, October 06, 2009 4:13 PM
>> To: java-comm...@lucene.apache.org
>> Subject: svn commit: r822284 -
>> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
>> lity.java
>>
>> Author: mikemccand
>> Date: Tue Oct  6 14:12:46 2009
>> New Revision: 822284
>>
>> URL: http://svn.apache.org/viewvc?rev=822284&view=rev
>> Log:
>> fix TestBackwardsCompability to not use deprecated APIs
>>
>> Modified:
>>
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> ity.java
>>
>> Modified:
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> ity.java
>> URL:
>> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/
>> index/TestBackwardsCompatibility.java?rev=822284&r1=822283&r2=822284&view=
>> diff
>> ==
>> 
>> ---
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> ity.java (original)
>> +++
>> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
>> ity.java Tue Oct  6 14:12:46 2009
>> @@ -158,11 +158,7 @@
>>      for(int i=0;i>        String dirName = "src/test/org/apache/lucene/index/index." +
>> oldNames[i];
>>        unzip(dirName, oldNames[i]);
>> -      changeIndexNoAdds(oldNames[i], true);
>> -      rmDir(oldNames[i]);
>> -
>> -      unzip(dirName, oldNames[i]);
>> -      changeIndexNoAdds(oldNames[i], false);
>> +      changeIndexNoAdds(oldNames[i]);
>>        rmDir(oldNames[i]);
>>      }
>>    }
>> @@ -171,11 +167,7 @@
>>      for(int i=0;i>        String dirName = "src/test/org/apache/lucene/index/index." +
>> oldNames[i];
>>        unzip(dirName, oldNames[i]);
>> -      changeIndexWithAdds(oldNames[i], true);
>> -      rmDir(oldNames[i]);
>> -
>> -      unzip(dirName, oldNames[i]);
>> -      changeIndexWithAdds(oldNames[i], false);
>> +      changeIndexWithAdds(oldNames[i]);
>>        rmDir(oldNames[i]);
>>      }
>>    }
>> @@ -196,7 +188,7 @@
>>      dirName = fullDir(dirName);
>>
>>      Directory dir = FSDirectory.open(new File(dirName));
>> -    IndexSearcher searcher = new IndexSearcher(dir);
>> +    IndexSearcher searcher = new IndexSearcher(dir, true);
>>      IndexReader reader = searcher.getIndexReader();
>>
>>      _TestUtil.checkIndex(dir);
>> @@ -267,14 +259,14 @@
>>
>>    /* Open pre-lockless index, add docs, do a delete &
>>     * setNorm, and search */
>> -  public void changeIndexWithAdds(String dirName, boolean autoCommit)
>> throws IOException {
>> +  public void changeIndexWithAdds(String dirName) throws IOException {
>>      String origDirName = dirName;
>>      dirName = fullDir(dirName);
>>
>>      Directory dir = FSDirectory.open(new File(dirName));
>>
>>      // open writer
>> -    IndexWriter writer = new IndexWriter(dir, autoCommit, new
>> WhitespaceAnalyzer(), false);
>> +    IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(),
>> false, IndexWriter.MaxFieldLength.UNLIMITED);
>>
>>      // add 10 docs
>>      for(int i=0;i<10;i++) {
>> @@ -288,11 +280,11 @@
>>      } else {
>>        expected = 46;
>>      }
>> -    assertEquals("wrong doc count", expected, writer.docCount());
>> +    assertEquals("wrong doc count", expected, writer.maxDoc());
>>      writer.close();
>>
>>      // make sure searching sees right # hits
>> -    IndexSearcher searcher = new IndexSearcher(dir);
>> +    IndexSearcher searcher = new IndexSearcher(dir, true);
>>      ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content",
>> "aaa")), null, 1000).scoreDocs;
>>      Document d = searcher.doc(hits[0].doc);
>>      assertEquals("wrong first document", "21", d.get("id"));
>> @@ -301,7 +293,7 @@
>>
>>      // make sure we can do delete & setNorm against this
>>      // pre-lockless segment:
>> -    IndexReader reader = IndexReader.open(dir);
>> +    IndexReader reader = IndexReader.open(dir, false);
>>      Term searchTerm = new Term("id", "6");
>>      int delCount = reader.deleteDocuments(searchTerm);
>>      assertEquals("wrong delete count", 1, delCount);
>> @@ -309,7 +301,7 @@
>>      reader.close();
>>
>>      // make sure they "took":
>> -    searcher = new IndexSearcher(dir);
>> +    searcher = new IndexSearcher(dir, true);
>>      hits = searcher.search(new TermQuery(new Term("content", "aaa")),
>> null, 1000).scoreDocs;
>>      assertEquals("wrong number of hits", 43, hits.length);
>>      d = searcher.doc(hits[0].doc);
>> @@ -318,11 +310,11 @@
>>      searcher.close();
>>
>>      // optimize
>

RE: svn commit: r822284 - /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

2009-10-06 Thread Uwe Schindler
Can you add this patch to backwards, too? I forgot, that some of the
backwards-changes also applied to BW, but for completeness, not sure, if a
tag is also needed.

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


> -Original Message-
> From: mikemcc...@apache.org [mailto:mikemcc...@apache.org]
> Sent: Tuesday, October 06, 2009 4:13 PM
> To: java-comm...@lucene.apache.org
> Subject: svn commit: r822284 -
> /lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibi
> lity.java
> 
> Author: mikemccand
> Date: Tue Oct  6 14:12:46 2009
> New Revision: 822284
> 
> URL: http://svn.apache.org/viewvc?rev=822284&view=rev
> Log:
> fix TestBackwardsCompability to not use deprecated APIs
> 
> Modified:
> 
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> ity.java
> 
> Modified:
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> ity.java
> URL:
> http://svn.apache.org/viewvc/lucene/java/trunk/src/test/org/apache/lucene/
> index/TestBackwardsCompatibility.java?rev=822284&r1=822283&r2=822284&view=
> diff
> ==
> 
> ---
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> ity.java (original)
> +++
> lucene/java/trunk/src/test/org/apache/lucene/index/TestBackwardsCompatibil
> ity.java Tue Oct  6 14:12:46 2009
> @@ -158,11 +158,7 @@
>  for(int i=0;iString dirName = "src/test/org/apache/lucene/index/index." +
> oldNames[i];
>unzip(dirName, oldNames[i]);
> -  changeIndexNoAdds(oldNames[i], true);
> -  rmDir(oldNames[i]);
> -
> -  unzip(dirName, oldNames[i]);
> -  changeIndexNoAdds(oldNames[i], false);
> +  changeIndexNoAdds(oldNames[i]);
>rmDir(oldNames[i]);
>  }
>}
> @@ -171,11 +167,7 @@
>  for(int i=0;iString dirName = "src/test/org/apache/lucene/index/index." +
> oldNames[i];
>unzip(dirName, oldNames[i]);
> -  changeIndexWithAdds(oldNames[i], true);
> -  rmDir(oldNames[i]);
> -
> -  unzip(dirName, oldNames[i]);
> -  changeIndexWithAdds(oldNames[i], false);
> +  changeIndexWithAdds(oldNames[i]);
>rmDir(oldNames[i]);
>  }
>}
> @@ -196,7 +188,7 @@
>  dirName = fullDir(dirName);
> 
>  Directory dir = FSDirectory.open(new File(dirName));
> -IndexSearcher searcher = new IndexSearcher(dir);
> +IndexSearcher searcher = new IndexSearcher(dir, true);
>  IndexReader reader = searcher.getIndexReader();
> 
>  _TestUtil.checkIndex(dir);
> @@ -267,14 +259,14 @@
> 
>/* Open pre-lockless index, add docs, do a delete &
> * setNorm, and search */
> -  public void changeIndexWithAdds(String dirName, boolean autoCommit)
> throws IOException {
> +  public void changeIndexWithAdds(String dirName) throws IOException {
>  String origDirName = dirName;
>  dirName = fullDir(dirName);
> 
>  Directory dir = FSDirectory.open(new File(dirName));
> 
>  // open writer
> -IndexWriter writer = new IndexWriter(dir, autoCommit, new
> WhitespaceAnalyzer(), false);
> +IndexWriter writer = new IndexWriter(dir, new WhitespaceAnalyzer(),
> false, IndexWriter.MaxFieldLength.UNLIMITED);
> 
>  // add 10 docs
>  for(int i=0;i<10;i++) {
> @@ -288,11 +280,11 @@
>  } else {
>expected = 46;
>  }
> -assertEquals("wrong doc count", expected, writer.docCount());
> +assertEquals("wrong doc count", expected, writer.maxDoc());
>  writer.close();
> 
>  // make sure searching sees right # hits
> -IndexSearcher searcher = new IndexSearcher(dir);
> +IndexSearcher searcher = new IndexSearcher(dir, true);
>  ScoreDoc[] hits = searcher.search(new TermQuery(new Term("content",
> "aaa")), null, 1000).scoreDocs;
>  Document d = searcher.doc(hits[0].doc);
>  assertEquals("wrong first document", "21", d.get("id"));
> @@ -301,7 +293,7 @@
> 
>  // make sure we can do delete & setNorm against this
>  // pre-lockless segment:
> -IndexReader reader = IndexReader.open(dir);
> +IndexReader reader = IndexReader.open(dir, false);
>  Term searchTerm = new Term("id", "6");
>  int delCount = reader.deleteDocuments(searchTerm);
>  assertEquals("wrong delete count", 1, delCount);
> @@ -309,7 +301,7 @@
>  reader.close();
> 
>  // make sure they "took":
> -searcher = new IndexSearcher(dir);
> +searcher = new IndexSearcher(dir, true);
>  hits = searcher.search(new TermQuery(new Term("content", "aaa")),
> null, 1000).scoreDocs;
>  assertEquals("wrong number of hits", 43, hits.length);
>  d = searcher.doc(hits[0].doc);
> @@ -318,11 +310,11 @@
>  searcher.close();
> 
>  // optimize
> -writer = new IndexWriter(dir, autoCommit, new WhitespaceAnalyzer(),
> false);
> +writer = new IndexWriter(dir, new WhitespaceAnalyzer(), false,
> IndexWriter.MaxFieldLength.UNLIMITED);
>  writer.