lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1211005 - in /lucene/dev/branches/lucene3606: lucene/src/test/org/apache/lucene/search/ lucene/src/test/org/apache/lucene/store/ solr/core/src/java/org/apache/solr/core/ solr/core/src/java/org/apache/solr/search/ solr/core/src/test/org/apa...
Date Tue, 06 Dec 2011 16:36:41 GMT
Author: rmuir
Date: Tue Dec  6 16:36:41 2011
New Revision: 1211005

URL: http://svn.apache.org/viewvc?rev=1211005&view=rev
Log:
LUCENE-3606: clear up some nocommits

Modified:
    lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
    lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
    lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
    lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java
    lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/StandardIndexReaderFactory.java
    lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
    lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
    lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java
    lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java

Modified: lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/search/TestMatchAllDocsQuery.java
Tue Dec  6 16:36:41 2011
@@ -44,9 +44,8 @@ public class TestMatchAllDocsQuery exten
     addDoc("one", iw, 1f);
     addDoc("two", iw, 20f);
     addDoc("three four", iw, 300f);
-    iw.close();
+    IndexReader ir = IndexReader.open(iw, true);
 
-    IndexReader ir = IndexReader.open(dir);
     IndexSearcher is = newSearcher(ir);
     ScoreDoc[] hits;
 
@@ -70,13 +69,16 @@ public class TestMatchAllDocsQuery exten
     hits = is.search(bq, null, 1000).scoreDocs;
     assertEquals(1, hits.length);
 
-    /* nocommit: fix this test to delete a document with IW
-    // delete a document:
-    is.getIndexReader().deleteDocument(0);
+    iw.deleteDocuments(new Term("key", "one"));
+    is.close();
+    ir.close();
+    ir = IndexReader.open(iw, true);
+    is = newSearcher(ir);
+    
     hits = is.search(new MatchAllDocsQuery(), null, 1000).scoreDocs;
     assertEquals(2, hits.length);
-    */
-    
+
+    iw.close();
     is.close();
     ir.close();
     dir.close();

Modified: lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/test/org/apache/lucene/store/TestBufferedIndexInput.java
Tue Dec  6 16:36:41 2011
@@ -240,7 +240,6 @@ public class TestBufferedIndexInput exte
       }
     }
 
-    /* nocommit: fix deletions to use IW
     public void testSetBufferSize() throws IOException {
       File indexDir = _TestUtil.getTempDir("testSetBufferSize");
       MockFSDirectory dir = new MockFSDirectory(indexDir, random);
@@ -257,25 +256,33 @@ public class TestBufferedIndexInput exte
           doc.add(newField("id", "" + i, TextField.TYPE_STORED));
           writer.addDocument(doc);
         }
-        writer.close();
 
         dir.allIndexInputs.clear();
 
-        IndexReader reader = IndexReader.open(dir);
+        IndexReader reader = IndexReader.open(writer, true);
         Term aaa = new Term("content", "aaa");
         Term bbb = new Term("content", "bbb");
-        Term ccc = new Term("content", "ccc");
-        assertEquals(37, reader.docFreq(ccc));
-        reader.deleteDocument(0);
-        assertEquals(37, reader.docFreq(aaa));
-        dir.tweakBufferSizes();
-        reader.deleteDocument(4);
-        assertEquals(reader.docFreq(bbb), 37);
+        
+        reader.close();
+        
         dir.tweakBufferSizes();
-
+        writer.deleteDocuments(new Term("id", "0"));
+        reader = IndexReader.open(writer, true);
         IndexSearcher searcher = newSearcher(reader);
         ScoreDoc[] hits = searcher.search(new TermQuery(bbb), null, 1000).scoreDocs;
         dir.tweakBufferSizes();
+        assertEquals(36, hits.length);
+        
+        reader.close();
+        searcher.close();
+        
+        dir.tweakBufferSizes();
+        writer.deleteDocuments(new Term("id", "4"));
+        reader = IndexReader.open(writer, true);
+        searcher = newSearcher(reader);
+
+        hits = searcher.search(new TermQuery(bbb), null, 1000).scoreDocs;
+        dir.tweakBufferSizes();
         assertEquals(35, hits.length);
         dir.tweakBufferSizes();
         hits = searcher.search(new TermQuery(new Term("id", "33")), null, 1000).scoreDocs;
@@ -284,13 +291,12 @@ public class TestBufferedIndexInput exte
         hits = searcher.search(new TermQuery(aaa), null, 1000).scoreDocs;
         dir.tweakBufferSizes();
         assertEquals(35, hits.length);
+        writer.close();
         searcher.close();
-        reader.close();
       } finally {
         _TestUtil.rmDir(indexDir);
       }
     }
-    */
 
     private static class MockFSDirectory extends Directory {
 

Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/IndexReaderFactory.java
Tue Dec  6 16:36:41 2011
@@ -57,10 +57,9 @@ public abstract class IndexReaderFactory
    * Creates a new IndexReader instance using the given Directory.
    * 
    * @param indexDir indexDir index location
-   * @param readOnly return readOnly IndexReader
    * @return An IndexReader instance
    * @throws IOException
    */
-  public abstract IndexReader newReader(Directory indexDir, boolean readOnly)
+  public abstract IndexReader newReader(Directory indexDir)
       throws IOException;
 }

Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java (original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/SolrCore.java Tue
Dec  6 16:36:41 2011
@@ -314,12 +314,7 @@ public final class SolrCore implements S
 
   // gets a non-caching searcher
   public SolrIndexSearcher newSearcher(String name) throws IOException {
-    return newSearcher(name, false);
-  }
-  
-  // gets a non-caching searcher
-  public SolrIndexSearcher newSearcher(String name, boolean readOnly) throws IOException
{
-    return new SolrIndexSearcher(this, getNewIndexDir(), schema, getSolrConfig().mainIndexConfig,
name, readOnly, false, directoryFactory);
+    return new SolrIndexSearcher(this, getNewIndexDir(), schema, getSolrConfig().mainIndexConfig,
name, false, directoryFactory);
   }
 
 
@@ -1146,7 +1141,7 @@ public final class SolrCore implements S
 
       } else {
         // verbose("non-reopen START:");
-        tmp = new SolrIndexSearcher(this, newIndexDir, schema, getSolrConfig().mainIndexConfig,
"main", true, true, directoryFactory);
+        tmp = new SolrIndexSearcher(this, newIndexDir, schema, getSolrConfig().mainIndexConfig,
"main", true, directoryFactory);
         // verbose("non-reopen DONE: searcher=",tmp);
       }
     } catch (Throwable th) {

Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/StandardIndexReaderFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/StandardIndexReaderFactory.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/StandardIndexReaderFactory.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/core/StandardIndexReaderFactory.java
Tue Dec  6 16:36:41 2011
@@ -29,13 +29,8 @@ import org.apache.lucene.store.Directory
  */
 public class StandardIndexReaderFactory extends IndexReaderFactory {
   
-  /* (non-Javadoc)
-   * @see org.apache.solr.core.IndexReaderFactory#newReader(org.apache.lucene.store.Directory,
boolean)
-   */
   @Override
-  public IndexReader newReader(Directory indexDir, boolean readOnly)
-      throws IOException {
-    assert readOnly; // nocommit: readOnly is ignored - remove
+  public IndexReader newReader(Directory indexDir) throws IOException {
     return IndexReader.open(indexDir, termInfosIndexDivisor);
   }
 }

Modified: lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
Tue Dec  6 16:36:41 2011
@@ -107,9 +107,9 @@ public class SolrIndexSearcher extends I
   private Collection<String> storedHighlightFieldNames;
   private DirectoryFactory directoryFactory;
   
-  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig
config, String name, boolean readOnly, boolean enableCache, DirectoryFactory directoryFactory)
throws IOException {
+  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig
config, String name, boolean enableCache, DirectoryFactory directoryFactory) throws IOException
{
     // we don't need to reserve the directory because we get it from the factory
-    this(core, schema,name, core.getIndexReaderFactory().newReader(directoryFactory.get(path,
config.lockType), readOnly), true, enableCache, false, directoryFactory);
+    this(core, schema,name, core.getIndexReaderFactory().newReader(directoryFactory.get(path,
config.lockType)), true, enableCache, false, directoryFactory);
   }
 
   public SolrIndexSearcher(SolrCore core, IndexSchema schema, String name, IndexReader r,
boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory)
{

Modified: lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/AlternateDirectoryTest.java
Tue Dec  6 16:36:41 2011
@@ -61,9 +61,7 @@ public class AlternateDirectoryTest exte
     static volatile boolean newReaderCalled = false;
 
     @Override
-    public IndexReader newReader(Directory indexDir, boolean readOnly)
-        throws IOException {
-      assert readOnly; // nocommit: readOnly is ignored - remove
+    public IndexReader newReader(Directory indexDir) throws IOException {
       TestIndexReaderFactory.newReaderCalled = true;
       return IndexReader.open(indexDir);
     }

Modified: lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderListener.java
Tue Dec  6 16:36:41 2011
@@ -75,7 +75,7 @@ public class TestQuerySenderListener ext
     assertNotNull("Event is null", evt);
     assertTrue(evt + " is not equal to " + EventParams.FIRST_SEARCHER, evt.equals(EventParams.FIRST_SEARCHER)
== true);
 
-    SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(),
core.getSolrConfig().mainIndexConfig, "testQuerySenderListener", true, false, core.getDirectoryFactory());
+    SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(),
core.getSolrConfig().mainIndexConfig, "testQuerySenderListener", false, core.getDirectoryFactory());
 
     qsl.newSearcher(newSearcher, currentSearcher);
     evt = mock.req.getParams().get(EventParams.EVENT);

Modified: lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java?rev=1211005&r1=1211004&r2=1211005&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java
(original)
+++ lucene/dev/branches/lucene3606/solr/core/src/test/org/apache/solr/core/TestQuerySenderNoQuery.java
Tue Dec  6 16:36:41 2011
@@ -75,7 +75,7 @@ public class TestQuerySenderNoQuery exte
     assertNotNull("Mock is null", mock);
     assertNull("Req (firstsearcher) is not null", mock.req);
 
-    SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(),
core.getSolrConfig().mainIndexConfig, "testQuerySenderNoQuery", true, false, core.getDirectoryFactory());
+    SolrIndexSearcher newSearcher = new SolrIndexSearcher(core, core.getNewIndexDir(), core.getSchema(),
core.getSolrConfig().mainIndexConfig, "testQuerySenderNoQuery", false, core.getDirectoryFactory());
 
     qsl.newSearcher(newSearcher, currentSearcher); // get newSearcher.
     assertNull("Req (newsearcher) is not null", mock.req);



Mime
View raw message