You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by Chris Hostetter <ho...@fucit.org> on 2011/06/24 23:37:02 UTC

Re: svn commit: r1137601 - /lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/Query Utils.java


: URL: http://svn.apache.org/viewvc?rev=1137601&view=rev 

: Log: revert speedup, the wrapping causes fc insanity. the only reason 
: this works today is that a new index is created in every setup/teardown, 
: which also makes these tests slow...

there are some other tests where a single field is used in multiple ways 
that would normally cause inanity over the life of a single test 
(Solr's TestSort comes to mind)

the solution used there was to have the test method directly call 
assertSaneFieldCache & purgeFieldCache after each chunk of work to ensure 
no "expected" insanity exists the next time assertSaneFieldCache is called


: 
: Modified:
:     lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/QueryUtils.java
: 
: Modified: lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/QueryUtils.java
: URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/QueryUtils.java?rev=1137601&r1=1137600&r2=1137601&view=diff
: ==============================================================================
: --- lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/QueryUtils.java (original)
: +++ lucene/dev/trunk/lucene/src/test-framework/org/apache/lucene/search/QueryUtils.java Mon Jun 20 12:00:12 2011
: @@ -148,35 +148,23 @@ public class QueryUtils {
:      // we can't put deleted docs before the nested reader, because
:      // it will throw off the docIds
:      IndexReader[] readers = new IndexReader[] {
: -      edge < 0 ? r : emptyReaders[0],
: -      emptyReaders[0],
: -      new MultiReader(edge < 0 ? emptyReaders[4] : emptyReaders[0],
: -          emptyReaders[0],
: -          0 == edge ? r : emptyReaders[0]),
: -      0 < edge ? emptyReaders[0] : emptyReaders[7],
: -      emptyReaders[0],
: -      new MultiReader(0 < edge ? emptyReaders[0] : emptyReaders[5],
: -          emptyReaders[0],
: -          0 < edge ? r : emptyReaders[0])
: +      edge < 0 ? r : IndexReader.open(makeEmptyIndex(random, 0), true),
: +      IndexReader.open(makeEmptyIndex(random, 0), true),
: +      new MultiReader(IndexReader.open(makeEmptyIndex(random, edge < 0 ? 4 : 0), true),
: +          IndexReader.open(makeEmptyIndex(random, 0), true),
: +          0 == edge ? r : IndexReader.open(makeEmptyIndex(random, 0), true)),
: +      IndexReader.open(makeEmptyIndex(random, 0 < edge ? 0 : 7), true),
: +      IndexReader.open(makeEmptyIndex(random, 0), true),
: +      new MultiReader(IndexReader.open(makeEmptyIndex(random, 0 < edge ? 0 : 5), true),
: +          IndexReader.open(makeEmptyIndex(random, 0), true),
: +          0 < edge ? r : IndexReader.open(makeEmptyIndex(random, 0), true))
:      };
:      IndexSearcher out = LuceneTestCase.newSearcher(new MultiReader(readers));
:      out.setSimilarityProvider(s.getSimilarityProvider());
:      return out;
:    }
: -  
: -  static final IndexReader[] emptyReaders = new IndexReader[8];
: -  static {
: -    try {
: -      emptyReaders[0] = makeEmptyIndex(new Random(0), 0);
: -      emptyReaders[4] = makeEmptyIndex(new Random(0), 4);
: -      emptyReaders[5] = makeEmptyIndex(new Random(0), 5);
: -      emptyReaders[7] = makeEmptyIndex(new Random(0), 7);
: -    } catch (IOException ex) {
: -      throw new RuntimeException(ex);
: -    }
: -  }
:  
: -  private static IndexReader makeEmptyIndex(Random random, final int numDeletedDocs) 
: +  private static Directory makeEmptyIndex(Random random, final int numDeletedDocs) 
:      throws IOException {
:      Directory d = new MockDirectoryWrapper(random, new RAMDirectory());
:        IndexWriter w = new IndexWriter(d, new IndexWriterConfig(
: @@ -200,7 +188,8 @@ public class QueryUtils {
:        IndexReader r = IndexReader.open(d, true);
:        Assert.assertEquals("reader has wrong number of deleted docs", 
:                            numDeletedDocs, r.numDeletedDocs());
: -      return r;
: +      r.close();
: +      return d;
:    }
:  
:    /** alternate scorer skipTo(),skipTo(),next(),next(),skipTo(),skipTo(), etc
: 
: 
: 

-Hoss

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