lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1066722 [1/2] - in /lucene/dev/branches/branch_3x: ./ lucene/ lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/ lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/ lucene/contrib/instantiated/sr...
Date Thu, 03 Feb 2011 02:27:38 GMT
Author: rmuir
Date: Thu Feb  3 02:27:35 2011
New Revision: 1066722

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

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

Modified: lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/analyzers/common/src/test/org/apache/lucene/analysis/query/QueryAutoStopWordAnalyzerTest.java Thu Feb  3 02:27:35 2011
@@ -76,7 +76,10 @@ public class QueryAutoStopWordAnalyzerTe
   private int search(Analyzer a, String queryString) throws IOException, ParseException {
     QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "repetitiveField", a);
     Query q = qp.parse(queryString);
-    return new IndexSearcher(reader).search(q, null, 1000).totalHits;
+    IndexSearcher searcher = newSearcher(reader);
+    int hits = searcher.search(q, null, 1000).totalHits;
+    searcher.close();
+    return hits;
   }
 
   public void testUninitializedAnalyzer() throws Exception {

Modified: lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/HighlighterPhraseTest.java Thu Feb  3 02:27:35 2011
@@ -68,7 +68,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"));
@@ -112,7 +112,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")),
@@ -182,7 +182,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"));
@@ -225,7 +225,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"));
@@ -266,7 +266,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/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/highlighter/src/test/org/apache/lucene/search/highlight/TokenSourcesTest.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestEmptyIndex.java Thu Feb  3 02:27:35 2011
@@ -36,7 +36,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/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/instantiated/src/test/org/apache/lucene/store/instantiated/TestRealTime.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/ChainedFilterTest.java Thu Feb  3 02:27:35 2011
@@ -73,7 +73,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();
@@ -195,7 +195,7 @@ public class ChainedFilterTest extends L
     IndexReader reader = writer.getReader();
     writer.close();
   
-    Searcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
   
     Query query = new TermQuery(new Term("none", "none"));
   

Modified: lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/DuplicateFilterTest.java Thu Feb  3 02:27:35 2011
@@ -59,7 +59,7 @@ public class DuplicateFilterTest extends
 
 		reader = writer.getReader();
 		writer.close();			
-		searcher =new IndexSearcher(reader);
+		searcher =newSearcher(reader);
 		
 	}
 	

Modified: lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/FuzzyLikeThisQueryTest.java Thu Feb  3 02:27:35 2011
@@ -52,7 +52,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/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/regex/TestRegexQuery.java Thu Feb  3 02:27:35 2011
@@ -47,7 +47,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/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queries/src/test/org/apache/lucene/search/similar/TestMoreLikeThis.java Thu Feb  3 02:27:35 2011
@@ -52,7 +52,7 @@ public class TestMoreLikeThis extends Lu
 
     reader = writer.getReader();
     writer.close();
-    searcher = new IndexSearcher(reader);
+    searcher = newSearcher(reader);
   }
   
   @Override

Modified: lucene/dev/branches/branch_3x/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/queryparser/src/test/org/apache/lucene/queryParser/standard/TestQPHelper.java Thu Feb  3 02:27:35 2011
@@ -1243,11 +1243,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/branches/branch_3x/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java (original)
+++ lucene/dev/branches/branch_3x/lucene/contrib/xml-query-parser/src/test/org/apache/lucene/xmlparser/TestParser.java Thu Feb  3 02:27:35 2011
@@ -71,7 +71,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/branches/branch_3x/lucene/src/java/org/apache/lucene/search/IndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/IndexSearcher.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/IndexSearcher.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/java/org/apache/lucene/search/IndexSearcher.java Thu Feb  3 02:27:35 2011
@@ -178,11 +178,7 @@ public class IndexSearcher extends Searc
     } else {
       subSearchers = new IndexSearcher[subReaders.length];
       for (int i = 0; i < subReaders.length; i++) {
-        if (subReaders[i] == r) {
-          subSearchers[i] = this;
-        } else {
-          subSearchers[i] = new IndexSearcher(subReaders[i]);
-        }
+        subSearchers[i] = new IndexSearcher(subReaders[i]);
       }
     }
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/collation/CollationTestBase.java Thu Feb  3 02:27:35 2011
@@ -141,7 +141,7 @@ public abstract class CollationTestBase 
     writer.close();
 
     IndexReader reader = IndexReader.open(farsiIndex, true);
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
         
     // Unicode order would include U+0633 in [ U+062F - U+0698 ], but Farsi
     // orders the U+0698 character before the U+0633 character, so the single

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDocument.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDocument.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/document/TestDocument.java Thu Feb  3 02:27:35 2011
@@ -157,7 +157,7 @@ public class TestDocument extends Lucene
     writer.addDocument(makeDocumentWithFields());
     IndexReader reader = writer.getReader();
     
-    Searcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // search for something that does exists
     Query query = new TermQuery(new Term("keyword", "test1"));
@@ -239,7 +239,7 @@ public class TestDocument extends Lucene
     writer.addDocument(doc);
     
     IndexReader reader = writer.getReader();
-    Searcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     Query query = new TermQuery(new Term("keyword", "test"));
     

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Thu Feb  3 02:27:35 2011
@@ -435,7 +435,7 @@ public class TestBackwardsCompatibility 
     // make sure we can do delete & setNorm against this
     // pre-lockless 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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestDeletionPolicy.java Thu Feb  3 02:27:35 2011
@@ -605,7 +605,7 @@ public class TestDeletionPolicy extends 
         IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3*i+1);
         reader.setNorm(4*i+1, "content", 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
@@ -641,7 +641,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) {
@@ -713,7 +713,7 @@ public class TestDeletionPolicy extends 
         IndexReader reader = IndexReader.open(dir, policy, false);
         reader.deleteDocument(3);
         reader.setNorm(5, "content", 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
@@ -748,7 +748,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReader.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReader.java Thu Feb  3 02:27:35 2011
@@ -987,7 +987,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexReaderReopen.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriter.java Thu Feb  3 02:27:35 2011
@@ -2830,7 +2830,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);
@@ -2846,6 +2846,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterDelete.java Thu Feb  3 02:27:35 2011
@@ -564,7 +564,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterOnDiskFull.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestIndexWriterReader.java Thu Feb  3 02:27:35 2011
@@ -707,8 +707,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");
@@ -771,7 +772,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;
     }
@@ -786,7 +789,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());
@@ -856,7 +861,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++) {
@@ -869,8 +876,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());
@@ -954,10 +962,11 @@ public class TestIndexWriterReader exten
     w.setMergedSegmentWarmer(new IndexWriter.IndexReaderWarmer() {
         @Override
         public void warm(IndexReader r) throws IOException {
-          final IndexSearcher s = new IndexSearcher(r);
+          final IndexSearcher s = newSearcher(r);
           final TopDocs hits = s.search(new TermQuery(new Term("foo", "bar")), 10);
           assertEquals(20, hits.totalHits);
           didWarm.set(true);
+          s.close();
         }
       });
     

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestLazyProxSkipping.java Thu Feb  3 02:27:35 2011
@@ -92,7 +92,7 @@ public class TestLazyProxSkipping extend
         
         SegmentReader reader = SegmentReader.getOnlySegmentReader(directory);
 
-        this.searcher = new IndexSearcher(reader);        
+      this.searcher = newSearcher(reader);
     }
     
     private ScoreDoc[] search() throws IOException {
@@ -119,7 +119,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestNRTThreads.java Thu Feb  3 02:27:35 2011
@@ -77,7 +77,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");
@@ -336,7 +338,7 @@ public class TestNRTThreads extends Luce
     }
     
     final IndexReader r2 = writer.getReader();
-    final IndexSearcher s = new IndexSearcher(r2);
+    final IndexSearcher s = newSearcher(r2);
     for(String id : delIDs) {
       final TopDocs hits = s.search(new TermQuery(new Term("id", id)), 1);
       if (hits.totalHits != 0) {
@@ -352,6 +354,7 @@ public class TestNRTThreads extends Luce
     assertFalse(writer.anyNonBulkMerges);
     writer.close(false);
     _TestUtil.checkIndex(dir);
+    s.close();
     dir.close();
     _TestUtil.rmDir(tempDir);
     docs.close();
@@ -366,7 +369,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/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestParallelReader.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestParallelReader.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/index/TestParallelReader.java Thu Feb  3 02:27:35 2011
@@ -51,7 +51,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();
@@ -284,7 +286,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/branches/branch_3x/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/queryParser/TestQueryParser.java Thu Feb  3 02:27:35 2011
@@ -1095,10 +1095,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBoolean2.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBoolean2.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBoolean2.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBoolean2.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanMinShouldMatch.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanOr.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanQuery.java Thu Feb  3 02:27:35 2011
@@ -72,7 +72,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);
 
@@ -109,6 +109,7 @@ public class TestBooleanQuery extends Lu
     dmq.add(pq);
     assertEquals(1, s.search(dmq, 10).totalHits);
     
+    s.close();
     r.close();
     w.close();
     dir.close();
@@ -135,8 +136,9 @@ public class TestBooleanQuery extends Lu
     qp.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
     
     MultiReader multireader = new MultiReader(reader1, reader2);
-    IndexSearcher searcher = new IndexSearcher(multireader);
+    IndexSearcher searcher = newSearcher(multireader);
     assertEquals(0, searcher.search(qp.parse("+foo -ba*"), 10).totalHits);
+    searcher.close();
     
     final ExecutorService es = Executors.newCachedThreadPool();
     searcher = new IndexSearcher(multireader, es);

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestBooleanScorer.java Thu Feb  3 02:27:35 2011
@@ -55,9 +55,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();
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingSpanFilter.java Thu Feb  3 02:27:35 2011
@@ -45,7 +45,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();
@@ -53,7 +53,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);
@@ -73,7 +74,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);
@@ -87,7 +89,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);
@@ -105,7 +108,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);
@@ -115,7 +119,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);
@@ -129,6 +134,7 @@ public class TestCachingSpanFilter exten
     // entry:
     assertTrue(oldReader != null);
 
+    searcher.close();
     writer.close();
     reader.close();
     dir.close();

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestCachingWrapperFilter.java Thu Feb  3 02:27:35 2011
@@ -161,7 +161,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();
@@ -169,7 +169,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);
@@ -189,7 +190,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);
@@ -204,7 +206,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);
 
@@ -223,7 +226,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);
@@ -233,7 +237,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);
@@ -248,7 +253,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);
@@ -260,7 +266,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);
@@ -278,6 +285,7 @@ public class TestCachingWrapperFilter ex
     // entry:
     assertTrue(oldReader != null);
 
+    searcher.close();
     reader.close();
     writer.close();
     dir.close();

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestComplexExplanations.java Thu Feb  3 02:27:35 2011
@@ -36,6 +36,12 @@ public class TestComplexExplanations ext
     super.setUp();
     searcher.setSimilarity(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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestConstantScoreQuery.java Thu Feb  3 02:27:35 2011
@@ -93,7 +93,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.setSimilarity(new DefaultSimilarity() {

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateFilter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateFilter.java Thu Feb  3 02:27:35 2011
@@ -58,7 +58,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);
@@ -99,6 +99,7 @@ public class TestDateFilter extends Luce
     
     result = searcher.search(query2, df2, 1000).scoreDocs;
     assertEquals(0, result.length);
+    searcher.close();
     reader.close();
     indexStore.close();
   }
@@ -124,7 +125,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);
@@ -166,6 +167,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateSort.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateSort.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateSort.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDateSort.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDisjunctionMaxQuery.java Thu Feb  3 02:27:35 2011
@@ -147,7 +147,7 @@ public class TestDisjunctionMaxQuery ext
     writer.optimize();
     r = writer.getReader();
     writer.close();
-    s = new IndexSearcher(r);
+    s = newSearcher(r);
     s.setSimilarity(sim);
   }
   

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocBoost.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocBoost.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocBoost.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocBoost.java Thu Feb  3 02:27:35 2011
@@ -63,7 +63,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestDocIdSet.java Thu Feb  3 02:27:35 2011
@@ -108,7 +108,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestElevationComparator.java Thu Feb  3 02:27:35 2011
@@ -47,7 +47,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestExplanations.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestExplanations.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestExplanations.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestExplanations.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheRangeFilter.java Thu Feb  3 02:27:35 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);
         
@@ -124,14 +124,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);
@@ -187,6 +187,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
@@ -195,7 +196,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);
@@ -281,13 +282,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);
@@ -374,13 +376,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);
@@ -467,6 +470,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
@@ -475,7 +479,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);
@@ -498,13 +502,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);
@@ -527,6 +532,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). The DocIdSet should be not cacheable, as it uses TermDocs if the range contains 0
@@ -547,7 +553,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;
@@ -573,6 +579,7 @@ public class TestFieldCacheRangeFilter e
     result = search.search(q,fcrf=FieldCacheRangeFilter.newByteRange("id",Byte.valueOf((byte) -20),Byte.valueOf((byte) -10),T,T), 100).scoreDocs;
     assertTrue("DocIdSet must be cacheable", fcrf.getDocIdSet(reader.getSequentialSubReaders()[0]).isCacheable());
     assertEquals("find all", 11, result.length);
+    search.close();
     reader.close();
     dir.close();
   }

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFieldCacheTermsFilter.java Thu Feb  3 02:27:35 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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFilteredQuery.java Thu Feb  3 02:27:35 2011
@@ -78,7 +78,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/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestFuzzyQuery.java Thu Feb  3 02:27:35 2011
@@ -26,6 +26,7 @@ import org.apache.lucene.util.LuceneTest
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.Field;
 import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.index.MultiReader;
 import org.apache.lucene.index.RandomIndexWriter;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.store.Directory;
@@ -49,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);   
@@ -197,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;
@@ -279,7 +280,7 @@ public class TestFuzzyQuery extends Luce
     reader.close();
     directory.close();
   }
-  
+
   public void testTokenLengthOpt() throws IOException {
     Directory directory = newDirectory();
     RandomIndexWriter writer = new RandomIndexWriter(random, directory);
@@ -287,7 +288,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;
@@ -325,7 +326,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"));
@@ -370,7 +371,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"));

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java Thu Feb  3 02:27:35 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);
     

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiPhraseQuery.java Thu Feb  3 02:27:35 2011
@@ -51,7 +51,7 @@ public class TestMultiPhraseQuery extend
     add("piccadilly circus", writer);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // search for "blueberry pi*":
     MultiPhraseQuery query1 = new MultiPhraseQuery();
@@ -135,12 +135,13 @@ public class TestMultiPhraseQuery extend
     IndexReader r = writer.getReader();
     writer.close();
 
-    IndexSearcher searcher = new IndexSearcher(r);
+    IndexSearcher searcher = newSearcher(r);
     MultiPhraseQuery q = new MultiPhraseQuery();
     q.add(new Term("body", "blueberry"));
     q.add(new Term("body", "chocolate"));
     q.add(new Term[] {new Term("body", "pie"), new Term("body", "tart")});
     assertEquals(2, searcher.search(q, 1).totalHits);
+    searcher.close();
     r.close();
     indexStore.close();
   }
@@ -164,7 +165,7 @@ public class TestMultiPhraseQuery extend
     add("blue raspberry pie", writer);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     // This query will be equivalent to +body:pie +body:"blue*"
     BooleanQuery q = new BooleanQuery();
     q.add(new TermQuery(new Term("body", "pie")), BooleanClause.Occur.MUST);
@@ -195,7 +196,7 @@ public class TestMultiPhraseQuery extend
     add("a note", "note", writer);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     // This query will be equivalent to +type:note +body:"a t*"
     BooleanQuery q = new BooleanQuery();
@@ -222,7 +223,7 @@ public class TestMultiPhraseQuery extend
     add("a note", "note", writer);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     
     MultiPhraseQuery q = new MultiPhraseQuery();
     q.add(new Term("body", "a"));
@@ -287,7 +288,7 @@ public class TestMultiPhraseQuery extend
     add("a note", "note", writer);
     
     IndexReader reader = writer.getReader();
-    IndexSearcher searcher = new IndexSearcher(reader);
+    IndexSearcher searcher = newSearcher(reader);
     searcher.setSimilarity(new DefaultSimilarity() {
       
       @Override

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiTermConstantScore.java Thu Feb  3 02:27:35 2011
@@ -150,7 +150,7 @@ public class TestMultiTermConstantScore 
   public void testEqualScores() throws IOException {
     // NOTE: uses index build in *this* setUp
 
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     ScoreDoc[] result;
 
@@ -173,13 +173,14 @@ public class TestMultiTermConstantScore 
           result[i].score);
     }
 
+    search.close();
   }
 
   @Test
   public void testBoost() throws IOException {
     // NOTE: uses index build in *this* setUp
 
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     // test for correct application of query normalization
     // must use a non score normalizing method for this.
@@ -245,13 +246,14 @@ public class TestMultiTermConstantScore 
     Assert.assertEquals(0, hits[0].doc);
     Assert.assertEquals(1, hits[1].doc);
     assertTrue(hits[0].score > hits[1].score);
+    search.close();
   }
 
   @Test
   public void testBooleanOrderUnAffected() throws IOException {
     // NOTE: uses index build in *this* setUp
 
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     // first do a regular TermRangeQuery which uses term expansion so
     // docs with more terms in range get higher scores
@@ -276,6 +278,7 @@ public class TestMultiTermConstantScore 
           actual[i].doc);
     }
 
+    search.close();
   }
 
   @Test
@@ -283,7 +286,7 @@ public class TestMultiTermConstantScore 
     // NOTE: uses index build in *super* setUp
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int medId = ((maxId - minId) / 2);
 
@@ -404,6 +407,8 @@ public class TestMultiTermConstantScore 
 
     result = search.search(csrq("id", medIP, medIP, T, T, MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT), null, numDocs).scoreDocs;
     assertEquals("med,med,T,T", 1, result.length);
+    
+    search.close();
   }
 
   @Test
@@ -411,7 +416,7 @@ public class TestMultiTermConstantScore 
     // NOTE: uses index build in *super* setUp
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     int medId = ((maxId - minId) / 2);
 
@@ -488,6 +493,8 @@ public class TestMultiTermConstantScore 
 
     result = search.search(csrq("id", medIP, medIP, T, T, c), null, numDocs).scoreDocs;
     assertEquals("med,med,T,T,c", 1, result.length);
+    
+    search.close();
   }
 
   @Test
@@ -495,7 +502,7 @@ public class TestMultiTermConstantScore 
     // NOTE: uses index build in *super* setUp
 
     IndexReader reader = signedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     String minRP = pad(signedIndexDir.minR);
     String maxRP = pad(signedIndexDir.maxR);
@@ -551,6 +558,7 @@ public class TestMultiTermConstantScore 
     result = search.search(csrq("rand", maxRP, null, T, F), null, numDocs).scoreDocs;
     assertEquals("max,nul,T,T", 1, result.length);
 
+    search.close();
   }
 
   @Test
@@ -559,7 +567,7 @@ public class TestMultiTermConstantScore 
 
     // using the unsigned index because collation seems to ignore hyphens
     IndexReader reader = unsignedIndexReader;
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     String minRP = pad(unsignedIndexDir.minR);
     String maxRP = pad(unsignedIndexDir.maxR);
@@ -616,6 +624,8 @@ public class TestMultiTermConstantScore 
     assertEquals("max,max,T,T,c", 1, result.length);
     result = search.search(csrq("rand", maxRP, null, T, F, c), null, numDocs).scoreDocs;
     assertEquals("max,nul,T,T,c", 1, result.length);
+    
+    search.close();
   }
 
   @Test
@@ -635,7 +645,7 @@ public class TestMultiTermConstantScore 
     IndexReader reader = writer.getReader();
     writer.close();
 
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     // Neither Java 1.4.2 nor 1.5.0 has Farsi Locale collation available in
     // RuleBasedCollator. However, the Arabic Locale seems to order the Farsi
@@ -680,7 +690,7 @@ public class TestMultiTermConstantScore 
     IndexReader reader = writer.getReader();
     writer.close();
 
-    IndexSearcher search = new IndexSearcher(reader);
+    IndexSearcher search = newSearcher(reader);
 
     Collator c = Collator.getInstance(new Locale("da", "dk"));
 

Modified: lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java?rev=1066722&r1=1066721&r2=1066722&view=diff
==============================================================================
--- lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java (original)
+++ lucene/dev/branches/branch_3x/lucene/src/test/org/apache/lucene/search/TestMultiValuedNumericRangeQuery.java Thu Feb  3 02:27:35 2011
@@ -59,7 +59,7 @@ public class TestMultiValuedNumericRange
     IndexReader reader = writer.getReader();
     writer.close();
     
-    Searcher searcher=new IndexSearcher(reader);
+    IndexSearcher searcher=newSearcher(reader);
     num = 50 * RANDOM_MULTIPLIER;
     for (int i = 0; i < num; i++) {
       int lower=random.nextInt(Integer.MAX_VALUE);



Mime
View raw message