lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r793102 - in /lucene/java/branches/lucene_2_4_back_compat_tests/src: java/org/apache/lucene/index/ test/org/apache/lucene/index/
Date Fri, 10 Jul 2009 20:41:09 GMT
Author: mikemccand
Date: Fri Jul 10 20:41:09 2009
New Revision: 793102

URL: http://svn.apache.org/viewvc?rev=793102&view=rev
Log:
LUCENE-1609: remove synchronization from terms dict by loading index up front

Modified:
    lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/IndexReader.java
    lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentReader.java
    lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermDocs.java

Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/IndexReader.java?rev=793102&r1=793101&r2=793102&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/IndexReader.java
(original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/IndexReader.java
Fri Jul 10 20:41:09 2009
@@ -279,6 +279,11 @@
     return open(directory, false, deletionPolicy, null, readOnly);
   }
 
+  public static IndexReader open(final Directory directory, IndexDeletionPolicy deletionPolicy,
boolean readOnly, int termInfosIndexDivisor) throws CorruptIndexException, IOException {
+    // stub
+    return null;
+  }
+
   /** Expert: returns a read/write IndexReader reading the index in the given
    * Directory, using a specific commit and with a custom
    * {@link IndexDeletionPolicy}.  <b>NOTE</b>: starting in
@@ -312,6 +317,11 @@
     return open(commit.getDirectory(), false, deletionPolicy, commit, readOnly);
   }
 
+  public static IndexReader open(final IndexCommit commit, IndexDeletionPolicy deletionPolicy,
boolean readOnly, int termInfosIndexDivisor) throws CorruptIndexException, IOException {
+    // stub
+    return null;
+  }
+
   private static IndexReader open(final Directory directory, final boolean closeDirectory,
final IndexDeletionPolicy deletionPolicy, final IndexCommit commit, final boolean readOnly)
throws CorruptIndexException, IOException {
     return DirectoryIndexReader.open(directory, closeDirectory, deletionPolicy, commit, readOnly);
   }

Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java?rev=793102&r1=793101&r2=793102&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
(original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/java/org/apache/lucene/index/SegmentReader.java
Fri Jul 10 20:41:09 2009
@@ -248,6 +248,11 @@
     return get(readOnly, si.dir, si, null, false, false, BufferedIndexInput.BUFFER_SIZE,
true);
   }
 
+  public static SegmentReader get(boolean readOnly, SegmentInfo si, int termsIndexDivisor)
throws CorruptIndexException, IOException {
+    // stub
+    return null;
+  }
+
   /**
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error

Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentReader.java?rev=793102&r1=793101&r2=793102&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentReader.java
(original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentReader.java
Fri Jul 10 20:41:09 2009
@@ -200,20 +200,4 @@
     assertTrue(results != null);
     assertTrue("We do not have 4 term freq vectors, we have: " + results.length, results.length
== 4);      
   }    
-  
-  public void testIndexDivisor() throws IOException {
-    dir = new MockRAMDirectory();
-    testDoc = new Document();
-    DocHelper.setupDoc(testDoc);
-    SegmentInfo si = DocHelper.writeDoc(dir, testDoc);
-    
-    reader = SegmentReader.get(si);
-    reader.setTermInfosIndexDivisor(3);
-    testDocument();
-    testDelete();
-    testGetFieldNameVariations();
-    testNorms();
-    testTerms();
-    testTermVectors();
-  }
 }

Modified: lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermDocs.java?rev=793102&r1=793101&r2=793102&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
(original)
+++ lucene/java/branches/lucene_2_4_back_compat_tests/src/test/org/apache/lucene/index/TestSegmentTermDocs.java
Fri Jul 10 20:41:09 2009
@@ -53,8 +53,7 @@
 
   public void testTermDocs(int indexDivisor) throws IOException {
     //After adding the document, we should be able to read it back in
-    SegmentReader reader = SegmentReader.get(info);
-    reader.setTermInfosIndexDivisor(indexDivisor);
+    SegmentReader reader = SegmentReader.get(true, info, indexDivisor);
     assertTrue(reader != null);
     SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
     assertTrue(segTermDocs != null);
@@ -76,8 +75,7 @@
   public void testBadSeek(int indexDivisor) throws IOException {
     {
       //After adding the document, we should be able to read it back in
-      SegmentReader reader = SegmentReader.get(info);
-      reader.setTermInfosIndexDivisor(indexDivisor);
+      SegmentReader reader = SegmentReader.get(true, info, indexDivisor);
       assertTrue(reader != null);
       SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
       assertTrue(segTermDocs != null);
@@ -87,8 +85,7 @@
     }
     {
       //After adding the document, we should be able to read it back in
-      SegmentReader reader = SegmentReader.get(info);
-      reader.setTermInfosIndexDivisor(indexDivisor);
+      SegmentReader reader = SegmentReader.get(true, info, indexDivisor);
       assertTrue(reader != null);
       SegmentTermDocs segTermDocs = new SegmentTermDocs(reader);
       assertTrue(segTermDocs != null);
@@ -123,9 +120,7 @@
     writer.optimize();
     writer.close();
     
-    IndexReader reader = IndexReader.open(dir);
-    reader.setTermInfosIndexDivisor(indexDivisor);
-    assertEquals(indexDivisor, reader.getTermInfosIndexDivisor());
+    IndexReader reader = IndexReader.open(dir, null, true, indexDivisor);
 
     TermDocs tdocs = reader.termDocs();
     
@@ -240,21 +235,6 @@
     testSkipTo(2);
   }
   
-  public void testIndexDivisorAfterLoad() throws IOException {
-    dir = new MockRAMDirectory();
-    testDoc = new Document();
-    DocHelper.setupDoc(testDoc);
-    SegmentInfo si = DocHelper.writeDoc(dir, testDoc);
-    SegmentReader reader = SegmentReader.get(si);
-    assertEquals(1, reader.docFreq(new Term("keyField", "Keyword")));
-    try {
-      reader.setTermInfosIndexDivisor(2);
-      fail("did not hit IllegalStateException exception");
-    } catch (IllegalStateException ise) {
-      // expected
-    }
-  }
-
   private void addDoc(IndexWriter writer, String value) throws IOException
   {
       Document doc = new Document();



Mime
View raw message