lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1066691 [1/2] - in /lucene/dev/trunk: lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/ lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/ lucene/contrib/queries/src/test/org/apache/lucene/sear...
Date Wed, 02 Feb 2011 23:27:29 GMT
Author: rmuir
Date: Wed Feb  2 23:27:25 2011
New Revision: 1066691

URL: http://svn.apache.org/viewvc?rev=1066691&view=rev
Log:
LUCENE-2751: add LuceneTestCase.newSearcher. use this to get an indexsearcher that randomly uses threads, etc

Modified:
    lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
    lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java
    lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
    lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java
    lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
    lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
    lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
    lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
    lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
    lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
    lucene/dev/trunk/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDocument.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestCodecs.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/CheckHits.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/QueryUtils.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateSort.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocBoost.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestExplanations.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiTermQueryRewrites.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNot.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery32.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestNumericRangeQuery64.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPhrasePrefixQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPhraseQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPositionIncrement.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPositiveScoresOnlyCollector.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixInBooleanQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestPrefixRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestQueryWrapperFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestRegexpRandom2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestScoreCachingWrappingScorer.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSearchWithThreads.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSimilarity.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSimilarityProvider.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSloppyPhraseQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSort.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestSubScorerFreqs.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermRangeFilter.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermScorer.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTermVectors.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTimeLimitingCollector.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTopDocsCollector.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestTopScoreDocCollector.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestWildcardRandom.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/PayloadHelper.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadNearQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/payloads/TestPayloadTermQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestBasics.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestFieldMaskingSpanQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestNearSpansOrdered.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestPayloadSpans.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpanFirstQuery.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpanMultiTermQueryWrapper.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpans.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/spans/TestSpansAdvanced2.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/store/TestRAMDirectory.java
    lucene/dev/trunk/lucene/src/test/org/apache/lucene/util/LuceneTestCase.java
    lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
    lucene/dev/trunk/modules/analysis/common/src/test/org/apache/lucene/collation/CollationTestBase.java

Modified: lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (original)
+++ lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java Wed Feb  2 23:27:25 2011
@@ -70,7 +70,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "fox"));
@@ -114,7 +114,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
             new SpanTermQuery(new Term(FIELD, "fox")),
@@ -184,7 +184,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "did"));
@@ -227,7 +227,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final PhraseQuery phraseQuery = new PhraseQuery();
         phraseQuery.add(new Term(FIELD, "did"));
@@ -268,7 +268,7 @@ public class HighlighterPhraseTest exten
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final Query phraseQuery = new SpanNearQuery(new SpanQuery[] {
             new SpanTermQuery(new Term(FIELD, "did")),

Modified: lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (original)
+++ lucene/dev/trunk/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java Wed Feb  2 23:27:25 2011
@@ -113,7 +113,7 @@ public class TokenSourcesTest extends Lu
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final DisjunctionMaxQuery query = new DisjunctionMaxQuery(1);
         query.add(new SpanTermQuery(new Term(FIELD, "{fox}")));
@@ -159,7 +159,7 @@ public class TokenSourcesTest extends Lu
     final IndexReader indexReader = IndexReader.open(directory, true);
     try {
       assertEquals(1, indexReader.numDocs());
-      final IndexSearcher indexSearcher = new IndexSearcher(indexReader);
+      final IndexSearcher indexSearcher = newSearcher(indexReader);
       try {
         final DisjunctionMaxQuery query = new DisjunctionMaxQuery(1);
         query.add(new SpanTermQuery(new Term(FIELD, "{fox}")));

Modified: lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java (original)
+++ lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java Wed Feb  2 23:27:25 2011
@@ -37,7 +37,7 @@ public class TestEmptyIndex extends Luce
     InstantiatedIndex ii = new InstantiatedIndex();
 
     IndexReader r = new InstantiatedIndexReader(ii);
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
 
     TopDocs td = s.search(new TermQuery(new Term("foo", "bar")), 1);
 

Modified: lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java (original)
+++ lucene/dev/trunk/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java Wed Feb  2 23:27:25 2011
@@ -36,7 +36,7 @@ public class TestRealTime extends Lucene
 
     InstantiatedIndex index = new InstantiatedIndex();
     InstantiatedIndexReader reader = new InstantiatedIndexReader(index);
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     InstantiatedIndexWriter writer = new InstantiatedIndexWriter(index);
 
     Document doc;

Modified: lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java (original)
+++ lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java Wed Feb  2 23:27:25 2011
@@ -72,7 +72,7 @@ public class ChainedFilterTest extends L
     reader = writer.getReader();
     writer.close();
 
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
 
     // query for everything to make life easier
     BooleanQuery bq = new BooleanQuery();
@@ -194,7 +194,7 @@ public class ChainedFilterTest extends L
     IndexReader reader = writer.getReader();
     writer.close();
   
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
   
     Query query = new TermQuery(new Term("none", "none"));
   

Modified: lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (original)
+++ lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java Wed Feb  2 23:27:25 2011
@@ -61,7 +61,7 @@ public class DuplicateFilterTest extends
 
 		reader = writer.getReader();
 		writer.close();			
-		searcher =new IndexSearcher(reader);
+		searcher =newSearcher(reader);
 		
 	}
 	

Modified: lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java (original)
+++ lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java Wed Feb  2 23:27:25 2011
@@ -51,7 +51,7 @@ public class FuzzyLikeThisQueryTest exte
 		addDoc(writer, "johnathon smythe","6");
 		reader = writer.getReader();
 		writer.close();
-		searcher=new IndexSearcher(reader);			
+		searcher=newSearcher(reader);			
 	}
 	
 	@Override

Modified: lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java (original)
+++ lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Wed Feb  2 23:27:25 2011
@@ -51,7 +51,7 @@ public class TestRegexQuery extends Luce
     writer.addDocument(doc);
     reader = writer.getReader();
     writer.close();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
   }
 
   @Override

Modified: lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java (original)
+++ lucene/dev/trunk/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java Wed Feb  2 23:27:25 2011
@@ -53,7 +53,7 @@ public class TestMoreLikeThis extends Lu
 
     reader = writer.getReader();
     writer.close();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
   }
   
   @Override

Modified: lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/dev/trunk/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Wed Feb  2 23:27:25 2011
@@ -1278,11 +1278,12 @@ public class TestQPHelper extends Lucene
     doc.add(newField("field", "", Field.Store.NO, Field.Index.ANALYZED));
     w.addDocument(doc);
     IndexReader r = IndexReader.open(w, true);
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
     
     Query q = new StandardQueryParser(new CannedAnalyzer()).parse("\"a\"", "field");
     assertTrue(q instanceof MultiPhraseQuery);
     assertEquals(1, s.search(q, 10).totalHits);
+    s.close();
     r.close();
     w.close();
     dir.close();

Modified: lucene/dev/trunk/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (original)
+++ lucene/dev/trunk/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java Wed Feb  2 23:27:25 2011
@@ -73,7 +73,7 @@ public class TestParser extends LuceneTe
 			d.close();
       writer.close();
 		reader=IndexReader.open(dir, true);
-		searcher=new IndexSearcher(reader);
+		searcher=newSearcher(reader);
 		
 	}
 	

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/TestExternalCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/TestExternalCodecs.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/TestExternalCodecs.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/TestExternalCodecs.java Wed Feb  2 23:27:25 2011
@@ -671,7 +671,7 @@ public class TestExternalCodecs extends 
     testTermsOrder(r);
     
     assertEquals(NUM_DOCS-1, r.numDocs());
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
     assertEquals(NUM_DOCS-1, s.search(new TermQuery(new Term("field1", "standard")), 1).totalHits);
     assertEquals(NUM_DOCS-1, s.search(new TermQuery(new Term("field2", "pulsing")), 1).totalHits);
     r.close();
@@ -682,7 +682,7 @@ public class TestExternalCodecs extends 
     r = IndexReader.open(w, true);
     assertEquals(NUM_DOCS-2, r.maxDoc());
     assertEquals(NUM_DOCS-2, r.numDocs());
-    s = new IndexSearcher(r);
+    s = newSearcher(r);
     assertEquals(NUM_DOCS-2, s.search(new TermQuery(new Term("field1", "standard")), 1).totalHits);
     assertEquals(NUM_DOCS-2, s.search(new TermQuery(new Term("field2", "pulsing")), 1).totalHits);
     assertEquals(1, s.search(new TermQuery(new Term("id", "76")), 1).totalHits);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDocument.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDocument.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/document/TestDocument.java Wed Feb  2 23:27:25 2011
@@ -156,7 +156,7 @@ public class TestDocument extends Lucene
     writer.addDocument(makeDocumentWithFields());
     IndexReader reader = writer.getReader();
     
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // search for something that does exists
     Query query = new TermQuery(new Term("keyword", "test1"));
@@ -238,7 +238,7 @@ public class TestDocument extends Lucene
     writer.addDocument(doc);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     Query query = new TermQuery(new Term("keyword", "test"));
     

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Wed Feb  2 23:27:25 2011
@@ -409,7 +409,7 @@ public class TestBackwardsCompatibility 
 
     // make sure we can do delete & setNorm against this segment:
     IndexReader reader = IndexReader.open(dir, false);
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
     Term searchTerm = new Term("id", "6");
     int delCount = reader.deleteDocuments(searchTerm);
     assertEquals("wrong delete count", 1, delCount);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestCodecs.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestCodecs.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestCodecs.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestCodecs.java Wed Feb  2 23:27:25 2011
@@ -362,7 +362,7 @@ public class TestCodecs extends LuceneTe
 
   private ScoreDoc[] search(final IndexWriter writer, final Query q, final int n) throws IOException {
     final IndexReader reader = writer.getReader();
-    final IndexSearcher searcher = new IndexSearcher(reader);
+    final IndexSearcher searcher = newSearcher(reader);
     try {
       return searcher.search(q, null, n).scoreDocs;
     }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java Wed Feb  2 23:27:25 2011
@@ -652,7 +652,7 @@ public class TestDeletionPolicy extends 
         IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3*i+1);
         reader.setNorm(4*i+1, "content", conf.getSimilarityProvider().get("content").encodeNormValue(2.0F));
-        IndexSearcher searcher = new IndexSearcher(reader);
+        IndexSearcher searcher = newSearcher(reader);
         ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
         assertEquals(16*(1+i), hits.length);
         // this is a commit
@@ -696,7 +696,7 @@ public class TestDeletionPolicy extends 
 
           // Work backwards in commits on what the expected
           // count should be.
-          searcher = new IndexSearcher(reader);
+          searcher = newSearcher(reader);
           hits = searcher.search(query, null, 1000).scoreDocs;
           if (i > 1) {
             if (i % 2 == 0) {
@@ -772,7 +772,7 @@ public class TestDeletionPolicy extends 
         IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3);
         reader.setNorm(5, "content", conf.getSimilarityProvider().get("content").encodeNormValue(2.0F));
-        IndexSearcher searcher = new IndexSearcher(reader);
+        IndexSearcher searcher = newSearcher(reader);
         ScoreDoc[] hits = searcher.search(query, null, 1000).scoreDocs;
         assertEquals(16, hits.length);
         // this is a commit
@@ -807,7 +807,7 @@ public class TestDeletionPolicy extends 
 
           // Work backwards in commits on what the expected
           // count should be.
-          searcher = new IndexSearcher(reader);
+          searcher = newSearcher(reader);
           hits = searcher.search(query, null, 1000).scoreDocs;
           assertEquals(expectedCount, hits.length);
           searcher.close();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReader.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReader.java Wed Feb  2 23:27:25 2011
@@ -900,7 +900,7 @@ public class TestIndexReader extends Luc
 
       {
         IndexReader r = IndexReader.open(startDir);
-        IndexSearcher searcher = new IndexSearcher(r);
+        IndexSearcher searcher = newSearcher(r);
         ScoreDoc[] hits = null;
         try {
           hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
@@ -908,6 +908,7 @@ public class TestIndexReader extends Luc
           e.printStackTrace();
           fail("exception when init searching: " + e);
         }
+        searcher.close();
         r.close();
       }
 
@@ -1023,7 +1024,7 @@ public class TestIndexReader extends Luc
           }
           */
 
-          IndexSearcher searcher = new IndexSearcher(newReader);
+          IndexSearcher searcher = newSearcher(newReader);
           ScoreDoc[] hits = null;
           try {
             hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Wed Feb  2 23:27:25 2011
@@ -773,14 +773,14 @@ public class TestIndexReaderReopen exten
                 // not synchronized
                 IndexReader refreshed = r.reopen();
                 
-                IndexSearcher searcher = new IndexSearcher(refreshed);
+                IndexSearcher searcher = newSearcher(refreshed);
                 ScoreDoc[] hits = searcher.search(
                     new TermQuery(new Term("field1", "a" + rnd.nextInt(refreshed.maxDoc()))),
                     null, 1000).scoreDocs;
                 if (hits.length > 0) {
                   searcher.doc(hits[0].doc);
                 }
-                
+                searcher.close();
                 if (refreshed != r) {
                   refreshed.close();
                 }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java Wed Feb  2 23:27:25 2011
@@ -2817,7 +2817,7 @@ public class TestIndexWriter extends Luc
 
       for(int x=0;x<2;x++) {
         IndexReader r = w.getReader();
-        IndexSearcher s = new IndexSearcher(r);
+        IndexSearcher s = newSearcher(r);
 
         if (VERBOSE) {
           System.out.println("TEST: cycle x=" + x + " r=" + r);
@@ -2833,6 +2833,7 @@ public class TestIndexWriter extends Luc
             assertEquals("doc " + testID + ", field f" + fieldCount + " is wrong", docExp.get("f"+i),  doc.get("f"+i));
           }
         }
+        s.close();
         r.close();
         w.optimize();
       }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Wed Feb  2 23:27:25 2011
@@ -565,7 +565,7 @@ public class TestIndexWriterDelete exten
                + e);
         }
 
-        IndexSearcher searcher = new IndexSearcher(newReader);
+        IndexSearcher searcher = newSearcher(newReader);
         ScoreDoc[] hits = null;
         try {
           hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java Wed Feb  2 23:27:25 2011
@@ -177,7 +177,7 @@ public class TestIndexWriterOnDiskFull e
     IndexReader reader = IndexReader.open(startDir, true);
     assertEquals("first docFreq", 57, reader.docFreq(searchTerm));
     
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     ScoreDoc[] hits = searcher.search(new TermQuery(searchTerm), null, 1000).scoreDocs;
     assertEquals("first number of hits", 57, hits.length);
     searcher.close();
@@ -360,7 +360,7 @@ public class TestIndexWriterOnDiskFull e
             }
           }
           
-          searcher = new IndexSearcher(reader);
+          searcher = newSearcher(reader);
           try {
             hits = searcher.search(new TermQuery(searchTerm), null, END_COUNT).scoreDocs;
           } catch (IOException e) {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java Wed Feb  2 23:27:25 2011
@@ -718,8 +718,9 @@ public class TestIndexWriterReader exten
     // reader should remain usable even after IndexWriter is closed:
     assertEquals(100, r.numDocs());
     Query q = new TermQuery(new Term("indexname", "test"));
-    assertEquals(100, new IndexSearcher(r).search(q, 10).totalHits);
-
+    IndexSearcher searcher = newSearcher(r);
+    assertEquals(100, searcher.search(q, 10).totalHits);
+    searcher.close();
     try {
       r.reopen();
       fail("failed to hit AlreadyClosedException");
@@ -785,7 +786,9 @@ public class TestIndexWriterReader exten
         r = r2;
       }
       Query q = new TermQuery(new Term("indexname", "test"));
-      final int count = new IndexSearcher(r).search(q, 10).totalHits;
+      IndexSearcher searcher = newSearcher(r);
+      final int count = searcher.search(q, 10).totalHits;
+      searcher.close();
       assertTrue(count >= lastCount);
       lastCount = count;
     }
@@ -800,7 +803,9 @@ public class TestIndexWriterReader exten
       r = r2;
     }
     Query q = new TermQuery(new Term("indexname", "test"));
-    final int count = new IndexSearcher(r).search(q, 10).totalHits;
+    IndexSearcher searcher = newSearcher(r);
+    final int count = searcher.search(q, 10).totalHits;
+    searcher.close();
     assertTrue(count >= lastCount);
 
     assertEquals(0, excs.size());
@@ -873,7 +878,9 @@ public class TestIndexWriterReader exten
         r = r2;
       }
       Query q = new TermQuery(new Term("indexname", "test"));
-      sum += new IndexSearcher(r).search(q, 10).totalHits;
+      IndexSearcher searcher = newSearcher(r);
+      sum += searcher.search(q, 10).totalHits;
+      searcher.close();
     }
 
     for(int i=0;i<NUM_THREAD;i++) {
@@ -886,8 +893,9 @@ public class TestIndexWriterReader exten
       r = r2;
     }
     Query q = new TermQuery(new Term("indexname", "test"));
-    sum += new IndexSearcher(r).search(q, 10).totalHits;
-
+    IndexSearcher searcher = newSearcher(r);
+    sum += searcher.search(q, 10).totalHits;
+    searcher.close();
     assertTrue("no documents found at all", sum > 0);
 
     assertEquals(0, excs.size());
@@ -973,10 +981,11 @@ public class TestIndexWriterReader exten
             setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
               @Override
               public void warm(IndexReader r) throws IOException {
-                IndexSearcher s = new IndexSearcher(r);
+                IndexSearcher s = newSearcher(r);
                 TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10);
                 assertEquals(20, hits.totalHits);
                 didWarm.set(true);
+                s.close();
               }
             }).
             setMergePolicy(newLogMergePolicy(10))

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java Wed Feb  2 23:27:25 2011
@@ -98,7 +98,7 @@ public class TestLazyProxSkipping extend
 
       SegmentReader reader = getOnlySegmentReader(IndexReader.open(directory, false));
 
-        this.searcher = new IndexSearcher(reader);        
+      this.searcher = newSearcher(reader);
     }
     
     private ScoreDoc[] search() throws IOException {
@@ -126,7 +126,9 @@ public class TestLazyProxSkipping extend
         // test whether only the minimum amount of seeks()
         // are performed
         performTest(5);
+        searcher.close();
         performTest(10);
+        searcher.close();
     }
     
     public void testSeek() throws IOException {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java Wed Feb  2 23:27:25 2011
@@ -88,7 +88,9 @@ public class TestNRTThreads extends Luce
           }
         }
 
-        sum += new IndexSearcher(reader).search(new TermQuery(new Term("body", "united")), 10).totalHits;
+        IndexSearcher searcher = newSearcher(reader);
+        sum += searcher.search(new TermQuery(new Term("body", "united")), 10).totalHits;
+        searcher.close();
 
         if (VERBOSE) {
           System.out.println("TEST: warm visited " + sum + " fields");
@@ -352,7 +354,7 @@ public class TestNRTThreads extends Luce
     }
     
     final IndexReader r2 = writer.getReader();
-    final IndexSearcher s = new IndexSearcher(r2);
+    final IndexSearcher s = newSearcher(r2);
     boolean doFail = false;
     for(String id : delIDs) {
       final TopDocs hits = s.search(new TermQuery(new Term("id", id)), 1);
@@ -384,6 +386,7 @@ public class TestNRTThreads extends Luce
     assertFalse(writer.anyNonBulkMerges);
     writer.close(false);
     _TestUtil.checkIndex(dir);
+    s.close();
     dir.close();
     _TestUtil.rmDir(tempDir);
     docs.close();
@@ -398,7 +401,7 @@ public class TestNRTThreads extends Luce
   }
 
   private void smokeTestReader(IndexReader r) throws Exception {
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
     runQuery(s, new TermQuery(new Term("body", "united")));
     runQuery(s, new TermQuery(new Term("titleTokenized", "states")));
     PhraseQuery pq = new PhraseQuery();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestParallelReader.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestParallelReader.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestParallelReader.java Wed Feb  2 23:27:25 2011
@@ -47,7 +47,9 @@ public class TestParallelReader extends 
   @Override
   public void tearDown() throws Exception {
     single.getIndexReader().close();
+    single.close();
     parallel.getIndexReader().close();
+    parallel.close();
     dir.close();
     dir1.close();
     dir2.close();
@@ -267,7 +269,7 @@ public class TestParallelReader extends 
     ParallelReader pr = new ParallelReader();
     pr.add(IndexReader.open(dir1, false));
     pr.add(IndexReader.open(dir2, false));
-    return new IndexSearcher(pr);
+    return newSearcher(pr);
   }
 
   private Directory getDir1(Random random) throws IOException {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/index/TestPerFieldCodecSupport.java Wed Feb  2 23:27:25 2011
@@ -227,7 +227,7 @@ public class TestPerFieldCodecSupport ex
     }
     IndexReader reader = IndexReader.open(dir, null, true,
         IndexReader.DEFAULT_TERMS_INDEX_DIVISOR, codecs);
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     TopDocs search = searcher.search(new TermQuery(t), num + 10);
     assertEquals(num, search.totalHits);
     searcher.close();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java Wed Feb  2 23:27:25 2011
@@ -1142,10 +1142,11 @@ public class TestQueryParser extends Luc
     w.addDocument(doc);
     IndexReader r = IndexReader.open(w, true);
     w.close();
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
     QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "f", a);
     Query q = qp.parse("\"wizard of ozzy\"");
     assertEquals(1, s.search(q, 1).totalHits);
+    s.close();
     r.close();
     dir.close();
   }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/CheckHits.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/CheckHits.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/CheckHits.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/CheckHits.java Wed Feb  2 23:27:25 2011
@@ -100,11 +100,13 @@ public class CheckHits {
 
     for (int i = -1; i < 2; i++) {
       actual.clear();
-      QueryUtils.wrapUnderlyingReader
-        (random, searcher, i).search(query, c);
+      IndexSearcher s = QueryUtils.wrapUnderlyingReader
+        (random, searcher, i);
+      s.search(query, c);
       Assert.assertEquals("Wrap Reader " + i + ": " +
                           query.toString(defaultFieldName),
                           correct, actual);
+      s.close();
     }
   }
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/QueryUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/QueryUtils.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/QueryUtils.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/QueryUtils.java Wed Feb  2 23:27:25 2011
@@ -21,6 +21,7 @@ import org.apache.lucene.search.Weight.S
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.MockDirectoryWrapper;
 import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.ReaderUtil;
 
 import static org.apache.lucene.util.LuceneTestCase.TEST_VERSION_CURRENT;
@@ -114,9 +115,13 @@ public class QueryUtils {
         checkFirstSkipTo(q1,s);
         checkSkipTo(q1,s);
         if (wrap) {
-          check(random, q1, wrapUnderlyingReader(random, s, -1), false);
-          check(random, q1, wrapUnderlyingReader(random, s,  0), false);
-          check(random, q1, wrapUnderlyingReader(random, s, +1), false);
+          IndexSearcher wrapped;
+          check(random, q1, wrapped = wrapUnderlyingReader(random, s, -1), false);
+          wrapped.close();
+          check(random, q1, wrapped = wrapUnderlyingReader(random, s,  0), false);
+          wrapped.close();
+          check(random, q1, wrapped = wrapUnderlyingReader(random, s, +1), false);
+          wrapped.close();
         }
         checkExplanations(q1,s);
         checkSerialization(q1,s);
@@ -158,7 +163,7 @@ public class QueryUtils {
           IndexReader.open(makeEmptyIndex(random, 0), true),
           0 < edge ? r : IndexReader.open(makeEmptyIndex(random, 0), true))
     };
-    IndexSearcher out = new IndexSearcher(new MultiReader(readers));
+    IndexSearcher out = LuceneTestCase.newSearcher(new MultiReader(readers));
     out.setSimilarityProvider(s.getSimilarityProvider());
     return out;
   }
@@ -318,7 +323,7 @@ public class QueryUtils {
             // previous reader, hits NO_MORE_DOCS
             if (lastReader[0] != null) {
               final IndexReader previousReader = lastReader[0];
-              IndexSearcher indexSearcher = new IndexSearcher(previousReader);
+              IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
               Weight w = q.weight(indexSearcher);
               Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), ScorerContext.def());
               if (scorer != null) {
@@ -326,6 +331,7 @@ public class QueryUtils {
                 Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
               }
               leafPtr++;
+              indexSearcher.close();
             }
             lastReader[0] = context.reader;
             assert readerContextArray[leafPtr].reader == context.reader;
@@ -343,13 +349,14 @@ public class QueryUtils {
           // confirm that skipping beyond the last doc, on the
           // previous reader, hits NO_MORE_DOCS
           final IndexReader previousReader = lastReader[0];
-          IndexSearcher indexSearcher = new IndexSearcher(previousReader);
+          IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
           Weight w = q.weight(indexSearcher);
           Scorer scorer = w.scorer((AtomicReaderContext)previousReader.getTopReaderContext(), ScorerContext.def());
           if (scorer != null) {
             boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
             Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
           }
+          indexSearcher.close();
         }
       }
   }
@@ -400,13 +407,14 @@ public class QueryUtils {
         // previous reader, hits NO_MORE_DOCS
         if (lastReader[0] != null) {
           final IndexReader previousReader = lastReader[0];
-          IndexSearcher indexSearcher = new IndexSearcher(previousReader);
+          IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
           Weight w = q.weight(indexSearcher);
           Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), ScorerContext.def());
           if (scorer != null) {
             boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
             Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
           }
+          indexSearcher.close();
           leafPtr++;
         }
 
@@ -423,13 +431,14 @@ public class QueryUtils {
       // confirm that skipping beyond the last doc, on the
       // previous reader, hits NO_MORE_DOCS
       final IndexReader previousReader = lastReader[0];
-      IndexSearcher indexSearcher = new IndexSearcher(previousReader);
+      IndexSearcher indexSearcher = LuceneTestCase.newSearcher(previousReader);
       Weight w = q.weight(indexSearcher);
       Scorer scorer = w.scorer((AtomicReaderContext)indexSearcher.getTopReaderContext(), ScorerContext.def());
       if (scorer != null) {
         boolean more = scorer.advance(lastDoc[0] + 1) != DocIdSetIterator.NO_MORE_DOCS;
         Assert.assertFalse("query's last doc was "+ lastDoc[0] +" but skipTo("+(lastDoc[0]+1)+") got to "+scorer.docID(),more);
       }
+      indexSearcher.close();
     }
   }
 }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQuery.java Wed Feb  2 23:27:25 2011
@@ -62,7 +62,7 @@ public class TestAutomatonQuery extends 
         + " with numbers 1234 5678.9 and letter b");
     writer.addDocument(doc);
     reader = writer.getReader();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
     writer.close();
   }
   

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestAutomatonQueryUnicode.java Wed Feb  2 23:27:25 2011
@@ -82,7 +82,7 @@ public class TestAutomatonQueryUnicode e
     field.setValue("\uFFFD\uFFFD");
     writer.addDocument(doc);
     reader = writer.getReader();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
     writer.close();
   }
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBoolean2.java Wed Feb  2 23:27:25 2011
@@ -92,7 +92,7 @@ public class TestBoolean2 extends Lucene
       w.addDocument(doc);
     }
     reader = w.getReader();
-    bigSearcher = new IndexSearcher(reader);
+    bigSearcher = newSearcher(reader);
     w.close();
   }
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Wed Feb  2 23:27:25 2011
@@ -65,7 +65,7 @@ public class TestBooleanMinShouldMatch e
         }
 
         r = w.getReader();
-        s = new IndexSearcher(r);
+        s = newSearcher(r);
         w.close();
 //System.out.println("Set up " + getName());
     }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java Wed Feb  2 23:27:25 2011
@@ -154,7 +154,7 @@ public class TestBooleanOr extends Lucen
 
     reader = writer.getReader();
     //
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
     writer.close();
   }
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java Wed Feb  2 23:27:25 2011
@@ -73,7 +73,7 @@ public class TestBooleanQuery extends Lu
     w.addDocument(doc);
 
     IndexReader r = w.getReader();
-    IndexSearcher s = new IndexSearcher(r);
+    IndexSearcher s = newSearcher(r);
     BooleanQuery q = new BooleanQuery();
     q.add(new TermQuery(new Term("field", "a")), BooleanClause.Occur.SHOULD);
 
@@ -120,6 +120,7 @@ public class TestBooleanQuery extends Lu
     dmq.add(pq);
     assertEquals(1, s.search(dmq, 10).totalHits);
     
+    s.close();
     r.close();
     w.close();
     dir.close();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java Wed Feb  2 23:27:25 2011
@@ -56,9 +56,10 @@ public class TestBooleanScorer extends L
     query.add(booleanQuery1, BooleanClause.Occur.MUST);
     query.add(new TermQuery(new Term(FIELD, "9")), BooleanClause.Occur.MUST_NOT);
 
-    IndexSearcher indexSearcher = new IndexSearcher(ir);
+    IndexSearcher indexSearcher = newSearcher(ir);
     ScoreDoc[] hits = indexSearcher.search(query, null, 1000).scoreDocs;
     assertEquals("Number of matched documents", 2, hits.length);
+    indexSearcher.close();
     ir.close();
     directory.close();
   }
@@ -74,7 +75,7 @@ public class TestBooleanScorer extends L
     writer.commit();
     IndexReader ir = writer.getReader();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(ir);
+    IndexSearcher searcher = newSearcher(ir);
     BooleanWeight weight = (BooleanWeight) new BooleanQuery().createWeight(searcher);
     Scorer[] scorers = new Scorer[] {new Scorer(weight) {
       private int doc = -1;

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java Wed Feb  2 23:27:25 2011
@@ -48,7 +48,7 @@ public class TestCachingSpanFilter exten
     // but we use .reopen on this reader below and expect to
     // (must) get an NRT reader:
     IndexReader reader = IndexReader.open(writer.w, true);
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
 
     // add a doc, refresh the reader, and check that its there
     Document doc = new Document();
@@ -56,7 +56,8 @@ public class TestCachingSpanFilter exten
     writer.addDocument(doc);
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     TopDocs docs = searcher.search(new MatchAllDocsQuery(), 1);
     assertEquals("Should find a hit...", 1, docs.totalHits);
@@ -76,7 +77,8 @@ public class TestCachingSpanFilter exten
     writer.deleteDocuments(new Term("id", "1"));
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should *not* find a hit...", 0, docs.totalHits);
@@ -90,7 +92,8 @@ public class TestCachingSpanFilter exten
 
     writer.addDocument(doc);
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
         
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should find a hit...", 1, docs.totalHits);
@@ -108,7 +111,8 @@ public class TestCachingSpanFilter exten
     // that had no new deletions
     reader = refreshReader(reader);
     assertTrue(reader != oldReader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
     int missCount = filter.missCount;
     docs = searcher.search(constantScore, 1);
     assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);
@@ -118,7 +122,8 @@ public class TestCachingSpanFilter exten
     writer.deleteDocuments(new Term("id", "1"));
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should *not* find a hit...", 0, docs.totalHits);
@@ -132,6 +137,7 @@ public class TestCachingSpanFilter exten
     // entry:
     assertTrue(oldReader != null);
 
+    searcher.close();
     writer.close();
     reader.close();
     dir.close();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java Wed Feb  2 23:27:25 2011
@@ -170,7 +170,7 @@ public class TestCachingWrapperFilter ex
     // but we use .reopen on this reader below and expect to
     // (must) get an NRT reader:
     IndexReader reader = IndexReader.open(writer.w, true);
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
 
     // add a doc, refresh the reader, and check that its there
     Document doc = new Document();
@@ -178,7 +178,8 @@ public class TestCachingWrapperFilter ex
     writer.addDocument(doc);
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     TopDocs docs = searcher.search(new MatchAllDocsQuery(), 1);
     assertEquals("Should find a hit...", 1, docs.totalHits);
@@ -198,7 +199,8 @@ public class TestCachingWrapperFilter ex
     writer.deleteDocuments(new Term("id", "1"));
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should *not* find a hit...", 0, docs.totalHits);
@@ -213,7 +215,8 @@ public class TestCachingWrapperFilter ex
     writer.addDocument(doc);
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
         
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
 
@@ -232,7 +235,8 @@ public class TestCachingWrapperFilter ex
     // that had no change to deletions
     reader = refreshReader(reader);
     assertTrue(reader != oldReader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
     int missCount = filter.missCount;
     docs = searcher.search(constantScore, 1);
     assertEquals("[just filter] Should find a hit...", 1, docs.totalHits);
@@ -242,7 +246,8 @@ public class TestCachingWrapperFilter ex
     writer.deleteDocuments(new Term("id", "1"));
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     missCount = filter.missCount;
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
@@ -257,7 +262,8 @@ public class TestCachingWrapperFilter ex
 
     writer.addDocument(doc);
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
         
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should find a hit...", 1, docs.totalHits);
@@ -269,7 +275,8 @@ public class TestCachingWrapperFilter ex
     writer.deleteDocuments(new Term("id", "1"));
 
     reader = refreshReader(reader);
-    searcher = new IndexSearcher(reader);
+    searcher.close();
+    searcher = newSearcher(reader);
 
     docs = searcher.search(new MatchAllDocsQuery(), filter, 1);
     assertEquals("[query + filter] Should *not* find a hit...", 0, docs.totalHits);
@@ -287,6 +294,7 @@ public class TestCachingWrapperFilter ex
     // entry:
     assertTrue(oldReader != null);
 
+    searcher.close();
     reader.close();
     writer.close();
     dir.close();

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java Wed Feb  2 23:27:25 2011
@@ -36,6 +36,12 @@ public class TestComplexExplanations ext
     super.setUp();
     searcher.setSimilarityProvider(createQnorm1Similarity());
   }
+  
+  @Override
+  public void tearDown() throws Exception {
+    searcher.close();
+    super.tearDown();
+  }
 
   // must be static for weight serialization tests 
   private static DefaultSimilarity createQnorm1Similarity() {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java Wed Feb  2 23:27:25 2011
@@ -94,7 +94,7 @@ public class TestConstantScoreQuery exte
 
       reader = writer.getReader();
       writer.close();
-      searcher = new IndexSearcher(reader);
+      searcher = newSearcher(reader);
       
       // set a similarity that does not normalize our boost away
       searcher.setSimilarityProvider(new DefaultSimilarity() {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateFilter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateFilter.java Wed Feb  2 23:27:25 2011
@@ -57,7 +57,7 @@ public class TestDateFilter extends Luce
     
     IndexReader reader = writer.getReader();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // filter that should preserve matches
     // DateFilter df1 = DateFilter.Before("datefield", now);
@@ -98,6 +98,7 @@ public class TestDateFilter extends Luce
     
     result = searcher.search(query2, df2, 1000).scoreDocs;
     assertEquals(0, result.length);
+    searcher.close();
     reader.close();
     indexStore.close();
   }
@@ -123,7 +124,7 @@ public class TestDateFilter extends Luce
     
     IndexReader reader = writer.getReader();
     writer.close();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // filter that should preserve matches
     // DateFilter df1 = DateFilter.After("datefield", now);
@@ -165,6 +166,7 @@ public class TestDateFilter extends Luce
     
     result = searcher.search(query2, df2, 1000).scoreDocs;
     assertEquals(0, result.length);
+    searcher.close();
     reader.close();
     indexStore.close();
   }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateSort.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDateSort.java Wed Feb  2 23:27:25 2011
@@ -28,7 +28,6 @@ import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.IndexSearcher;
 import org.apache.lucene.search.Query;
 import org.apache.lucene.search.Sort;
 import org.apache.lucene.search.SortField;
@@ -78,7 +77,7 @@ public class TestDateSort extends Lucene
   }
 
   public void testReverseDateSort() throws Exception {
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
 
     Sort sort = new Sort(new SortField(DATE_TIME_FIELD, SortField.STRING, true));
 

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Wed Feb  2 23:27:25 2011
@@ -149,7 +149,7 @@ public class TestDisjunctionMaxQuery ext
     
     r = new SlowMultiReaderWrapper(writer.getReader());
     writer.close();
-    s = new IndexSearcher(r);
+    s = newSearcher(r);
     s.setSimilarityProvider(sim);
   }
   

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocBoost.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocBoost.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocBoost.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocBoost.java Wed Feb  2 23:27:25 2011
@@ -65,7 +65,7 @@ public class TestDocBoost extends Lucene
 
     final float[] scores = new float[4];
 
-    new IndexSearcher(reader).search
+    newSearcher(reader).search
       (new TermQuery(new Term("field", "word")),
        new Collector() {
          private int base = 0;

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java Wed Feb  2 23:27:25 2011
@@ -109,7 +109,7 @@ public class TestDocIdSet extends Lucene
     writer.close();
     
     // First verify the document is searchable.
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     Assert.assertEquals(1, searcher.search(new MatchAllDocsQuery(), 10).totalHits);
     
     // Now search w/ a Filter which returns a null DocIdSet

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java Wed Feb  2 23:27:25 2011
@@ -53,7 +53,7 @@ public class TestElevationComparator ext
     IndexReader r = IndexReader.open(writer, true);
     writer.close();
 
-    IndexSearcher searcher = new IndexSearcher(r);
+    IndexSearcher searcher = newSearcher(r);
 
     runTest(searcher, true);
     runTest(searcher, false);

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestExplanations.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestExplanations.java Wed Feb  2 23:27:25 2011
@@ -77,7 +77,7 @@ public class TestExplanations extends Lu
     }
     reader = writer.getReader();
     writer.close();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
   }
 
   protected String[] docFields = {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Wed Feb  2 23:27:25 2011
@@ -44,7 +44,7 @@ public class TestFieldCacheRangeFilter e
   public void testRangeFilterId() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int medId = ((maxId - minId) / 2);
         
@@ -122,14 +122,14 @@ public class TestFieldCacheRangeFilter e
 
     result = search.search(q,FieldCacheRangeFilter.newStringRange("id",medIP,medIP,T,T), numDocs).scoreDocs;
     assertEquals("med,med,T,T", 1, result.length);
-        
+    search.close();
   }
 
   @Test
   public void testFieldCacheRangeFilterRand() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     String minRP = pad(signedIndexDir.minR);
     String maxRP = pad(signedIndexDir.maxR);
@@ -185,6 +185,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("max,max,T,T", 1, result.length);
     result = search.search(q,FieldCacheRangeFilter.newStringRange("rand",maxRP,null,T,F), numDocs).scoreDocs;
     assertEquals("max,nul,T,T", 1, result.length);
+    search.close();
   }
   
   // byte-ranges cannot be tested, because all ranges are too big for bytes, need an extra range for that
@@ -193,7 +194,7 @@ public class TestFieldCacheRangeFilter e
   public void testFieldCacheRangeFilterShorts() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int numDocs = reader.numDocs();
     int medId = ((maxId - minId) / 2);
@@ -277,13 +278,14 @@ public class TestFieldCacheRangeFilter e
     assertEquals("overflow special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newShortRange("id",maxIdO,minIdO,T,T), numDocs).scoreDocs;
     assertEquals("inverse range", 0, result.length);
+    search.close();
   }
   
   @Test
   public void testFieldCacheRangeFilterInts() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int numDocs = reader.numDocs();
     int medId = ((maxId - minId) / 2);
@@ -368,13 +370,14 @@ public class TestFieldCacheRangeFilter e
     assertEquals("overflow special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newIntRange("id",maxIdO,minIdO,T,T), numDocs).scoreDocs;
     assertEquals("inverse range", 0, result.length);
+    search.close();
   }
   
   @Test
   public void testFieldCacheRangeFilterLongs() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int numDocs = reader.numDocs();
     int medId = ((maxId - minId) / 2);
@@ -459,6 +462,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("overflow special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newLongRange("id",maxIdO,minIdO,T,T), numDocs).scoreDocs;
     assertEquals("inverse range", 0, result.length);
+    search.close();
   }
   
   // float and double tests are a bit minimalistic, but its complicated, because missing precision
@@ -467,7 +471,7 @@ public class TestFieldCacheRangeFilter e
   public void testFieldCacheRangeFilterFloats() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int numDocs = reader.numDocs();
     Float minIdO = Float.valueOf(minId + .5f);
@@ -490,13 +494,14 @@ public class TestFieldCacheRangeFilter e
     assertEquals("infinity special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newFloatRange("id",null,Float.valueOf(Float.NEGATIVE_INFINITY),F,F), numDocs).scoreDocs;
     assertEquals("infinity special case", 0, result.length);
+    search.close();
   }
   
   @Test
   public void testFieldCacheRangeFilterDoubles() throws IOException {
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int numDocs = reader.numDocs();
     Double minIdO = Double.valueOf(minId + .5);
@@ -519,6 +524,7 @@ public class TestFieldCacheRangeFilter e
     assertEquals("infinity special case", 0, result.length);
     result = search.search(q,FieldCacheRangeFilter.newDoubleRange("id",null, Double.valueOf(Double.NEGATIVE_INFINITY),F,F), numDocs).scoreDocs;
     assertEquals("infinity special case", 0, result.length);
+    search.close();
   }
   
   // test using a sparse index (with deleted docs).
@@ -539,7 +545,7 @@ public class TestFieldCacheRangeFilter e
     writer.close();
 
     IndexReader reader = IndexReader.open(dir, true);
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
     assertTrue(reader.hasDeletions());
 
     ScoreDoc[] result;
@@ -559,6 +565,7 @@ public class TestFieldCacheRangeFilter e
 
     result = search.search(q,FieldCacheRangeFilter.newByteRange("id",Byte.valueOf((byte) -20),Byte.valueOf((byte) -10),T,T), 100).scoreDocs;
     assertEquals("find all", 11, result.length);
+    search.close();
     reader.close();
     dir.close();
   }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java Wed Feb  2 23:27:25 2011
@@ -47,7 +47,7 @@ public class TestFieldCacheTermsFilter e
     IndexReader reader = w.getReader();
     w.close();
 
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     int numDocs = reader.numDocs();
     ScoreDoc[] results;
     MatchAllDocsQuery q = new MatchAllDocsQuery();
@@ -68,6 +68,7 @@ public class TestFieldCacheTermsFilter e
     results = searcher.search(q, new FieldCacheTermsFilter(fieldName,  terms.toArray(new String[0])), numDocs).scoreDocs;
     assertEquals("Must match 2", 2, results.length);
 
+    searcher.close();
     reader.close();
     rd.close();
   }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java Wed Feb  2 23:27:25 2011
@@ -81,7 +81,7 @@ public class TestFilteredQuery extends L
     reader = writer.getReader();
     writer.close ();
 
-    searcher = new IndexSearcher (reader);
+    searcher = newSearcher(reader);
     query = new TermQuery (new Term ("field", "three"));
     filter = newStaticFilterB();
   }

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java Wed Feb  2 23:27:25 2011
@@ -50,7 +50,7 @@ public class TestFuzzyQuery extends Luce
     addDoc("ddddd", writer);
 
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     writer.close();
 
     FuzzyQuery query = new FuzzyQuery(new Term("field", "aaaaa"), FuzzyQuery.defaultMinSimilarity, 0);   
@@ -198,7 +198,7 @@ public class TestFuzzyQuery extends Luce
     addDoc("segment", writer);
 
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     writer.close();
 
     FuzzyQuery query;
@@ -309,7 +309,7 @@ public class TestFuzzyQuery extends Luce
     IndexReader ir2 = writer2.getReader();
     
     MultiReader mr = new MultiReader(ir1, ir2);
-    IndexSearcher searcher = new IndexSearcher(mr);
+    IndexSearcher searcher = newSearcher(mr);
     FuzzyQuery fq = new FuzzyQuery(new Term("field", "z123456"), 1f, 0, 2);
     TopDocs docs = searcher.search(fq, 2);
     assertEquals(5, docs.totalHits); // 5 docs, from the a and b's
@@ -330,7 +330,7 @@ public class TestFuzzyQuery extends Luce
     addDoc("segment", writer);
 
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     writer.close();
 
     Query query;
@@ -368,7 +368,7 @@ public class TestFuzzyQuery extends Luce
     addDoc("Lucenne", writer);
 
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     writer.close();
     
     FuzzyQuery query = new FuzzyQuery(new Term("field", "lucene"));
@@ -413,7 +413,7 @@ public class TestFuzzyQuery extends Luce
     Query q = new QueryParser(TEST_VERSION_CURRENT, "field", analyzer).parse( "giga~0.9" );
 
     // 3. search
-    IndexSearcher searcher = new IndexSearcher(r);
+    IndexSearcher searcher = newSearcher(r);
     ScoreDoc[] hits = searcher.search(q, 10).scoreDocs;
     assertEquals(1, hits.length);
     assertEquals("Giga byte", searcher.doc(hits[0].doc).get("field"));
@@ -435,7 +435,7 @@ public class TestFuzzyQuery extends Luce
     addDoc("test", w);
     addDoc("working", w);
     IndexReader reader = w.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     w.close();
     QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "field", new MockAnalyzer());
     

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery2.java Wed Feb  2 23:27:25 2011
@@ -91,7 +91,7 @@ public class TestFuzzyQuery2 extends Luc
     }   
     
     IndexReader r = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(r);
+    IndexSearcher searcher = newSearcher(r);
     writer.close();
     String line;
     while ((line = reader.readLine()) != null) {

Modified: lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=1066691&r1=1066690&r2=1066691&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (original)
+++ lucene/dev/trunk/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java Wed Feb  2 23:27:25 2011
@@ -47,7 +47,7 @@ public class TestMatchAllDocsQuery exten
     iw.close();
 
     IndexReader ir = IndexReader.open(dir, false);
-    IndexSearcher is = new IndexSearcher(ir);
+    IndexSearcher is = newSearcher(ir);
     ScoreDoc[] hits;
 
     // assert with norms scoring turned off
@@ -93,7 +93,7 @@ public class TestMatchAllDocsQuery exten
     assertEquals(1, hits.length);
 
     // delete a document:
-    is.getIndexReader().deleteDocument(0);
+    ir.deleteDocument(0);
     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
     assertEquals(2, hits.length);
     



Mime
View raw message