You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@lucene.apache.org by us...@apache.org on 2010/10/29 15:12:08 UTC

svn commit: r1028723 - in /lucene/java/branches/lucene_2_9: ./ src/java/org/apache/lucene/index/ src/test/org/apache/lucene/index/

Author: uschindler
Date: Fri Oct 29 13:12:08 2010
New Revision: 1028723

URL: http://svn.apache.org/viewvc?rev=1028723&view=rev
Log:
LUCENE-2675: Add support for Lucene 3.0 stored field files also in 2.9

Added:
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.cfs.zip   (with props)
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.nocfs.zip   (with props)
Modified:
    lucene/java/branches/lucene_2_9/CHANGES.txt
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsReader.java
    lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsWriter.java
    lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java

Modified: lucene/java/branches/lucene_2_9/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/CHANGES.txt?rev=1028723&r1=1028722&r2=1028723&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/CHANGES.txt (original)
+++ lucene/java/branches/lucene_2_9/CHANGES.txt Fri Oct 29 13:12:08 2010
@@ -46,7 +46,18 @@ Bug fixes
   if the writer had just committed (Nikolay Zamosenchuk via Mike McCandless)
 
 * LUCENE-2650: Added extra safety to MMapIndexInput clones to prevent accessing
-  an unmapped buffer if the input is closed (Mike McCandless, Uwe Schindler, Robert Muir) 
+  an unmapped buffer if the input is closed (Mike McCandless, Uwe Schindler, Robert Muir)
+  
+New features
+
+* LUCENE-2675: Add support for Lucene 3.0 stored field files also in 2.9.
+  The file format did not change, only the version number was upgraded to mark
+  segments that have no compression. FieldsWriter still only writes 2.9 segments
+  as they could contain compressed fields. This cross-version index format
+  compatibility is provided here solely because Lucene 2.9 and 3.0 have the
+  same bugfix level, features, and the same index format with this slight
+  compression difference. In general, Lucene does not support reading newer
+  indexes with older library versions. (Uwe Schindler)
   
 Documentation
 

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsReader.java?rev=1028723&r1=1028722&r2=1028723&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsReader.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsReader.java Fri Oct 29 13:12:08 2010
@@ -113,7 +113,9 @@ final class FieldsReader implements Clon
       else
         format = firstInt;
 
-      if (format > FieldsWriter.FORMAT_CURRENT)
+      if (format > FieldsWriter.FORMAT_CURRENT
+        /* extra support for Lucene 3.0 indexes: */ && format != FieldsWriter.FORMAT_LUCENE_3_0_NO_COMPRESSED_FIELDS
+      )
         throw new CorruptIndexException("Incompatible format version: " + format + " expected " 
                                         + FieldsWriter.FORMAT_CURRENT + " or lower");
 

Modified: lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsWriter.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsWriter.java?rev=1028723&r1=1028722&r2=1028723&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsWriter.java (original)
+++ lucene/java/branches/lucene_2_9/src/java/org/apache/lucene/index/FieldsWriter.java Fri Oct 29 13:12:08 2010
@@ -38,6 +38,12 @@ final class FieldsWriter
 
   // Changed strings to UTF8
   static final int FORMAT_VERSION_UTF8_LENGTH_IN_BYTES = 1;
+  
+  // Lucene 3.0: Removal of compressed fields: This is only to provide compatibility with 3.0-created indexes
+  // new segments always use the FORMAT_CURRENT. As the index format did not change in 3.0, only
+  // new stored field files that no longer support compression are marked as such to optimize merging.
+  // But 2.9 can still read them.
+  static final int FORMAT_LUCENE_3_0_NO_COMPRESSED_FIELDS = 2;
 
   // NOTE: if you introduce a new format, make it 1 higher
   // than the current one, and always change this if you

Modified: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java?rev=1028723&r1=1028722&r2=1028723&view=diff
==============================================================================
--- lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java (original)
+++ lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/TestBackwardsCompatibility.java Fri Oct 29 13:12:08 2010
@@ -128,6 +128,8 @@ public class TestBackwardsCompatibility 
                              "23.nocfs",
                              "24.cfs",
                              "24.nocfs",
+                             "30.cfs",
+                             "30.nocfs",
   };
 
   public void testOptimizeOldIndex() throws IOException {

Added: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.cfs.zip
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.cfs.zip?rev=1028723&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.cfs.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.nocfs.zip
URL: http://svn.apache.org/viewvc/lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.nocfs.zip?rev=1028723&view=auto
==============================================================================
Binary file - no diff available.

Propchange: lucene/java/branches/lucene_2_9/src/test/org/apache/lucene/index/index.30.nocfs.zip
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream