lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1196301 - in /lucene/dev/branches/lucene2621/lucene/src: java/org/apache/lucene/index/codecs/ java/org/apache/lucene/index/codecs/lucene3x/ java/org/apache/lucene/index/codecs/lucene40/ test/org/apache/lucene/index/
Date Tue, 01 Nov 2011 21:44:43 GMT
Author: rmuir
Date: Tue Nov  1 21:44:43 2011
New Revision: 1196301

URL: http://svn.apache.org/viewvc?rev=1196301&view=rev
Log:
LUCENE-3490: make Codec.segmentInfosFormat abstract

Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java
    lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java?rev=1196301&r1=1196300&r2=1196301&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
Tue Nov  1 21:44:43 2011
@@ -58,13 +58,7 @@ public abstract class Codec implements N
   /** Encodes/decodes stored fields, term vectors, fieldinfos */
   public abstract FieldsFormat fieldsFormat();
   
-  // nocommit: make abstract
-  public SegmentInfosFormat segmentInfosFormat() {
-    return siFormat;
-  }
-  
-  // nocommit
-  private final SegmentInfosFormat siFormat = new DefaultSegmentInfosFormat();
+  public abstract SegmentInfosFormat segmentInfosFormat();
   
   /** looks up a codec by name */
   public static Codec forName(String name) {
@@ -78,7 +72,7 @@ public abstract class Codec implements N
   
   private static Codec defaultCodec = Codec.forName("Lucene40");
   
-  // nocommit: should we remove these? 
+  // TODO: should we use this, or maybe a system property is better?
   public static Codec getDefault() {
     return defaultCodec;
   }

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java?rev=1196301&r1=1196300&r2=1196301&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
Tue Nov  1 21:44:43 2011
@@ -25,11 +25,13 @@ import org.apache.lucene.index.SegmentIn
 import org.apache.lucene.index.SegmentReadState;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.DefaultFieldsFormat;
+import org.apache.lucene.index.codecs.DefaultSegmentInfosFormat;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldsFormat;
 import org.apache.lucene.index.codecs.PerDocConsumer;
 import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.index.codecs.PostingsFormat;
+import org.apache.lucene.index.codecs.SegmentInfosFormat;
 import org.apache.lucene.store.Directory;
 
 /**
@@ -45,6 +47,11 @@ public class Lucene3xCodec extends Codec
   // TODO: this should really be a different impl
   private final FieldsFormat fieldsFormat = new DefaultFieldsFormat();
   
+  // TODO: this should really be a different impl
+  // also if we want preflex to *really* be read-only it should throw exception for the writer?
+  // this way IR.commit fails on delete/undelete/setNorm/etc ?
+  private final SegmentInfosFormat infosFormat = new DefaultSegmentInfosFormat();
+  
   // 3.x doesn't support docvalues
   private final DocValuesFormat docValuesFormat = new DocValuesFormat() {
     @Override
@@ -75,4 +82,9 @@ public class Lucene3xCodec extends Codec
   public FieldsFormat fieldsFormat() {
     return fieldsFormat;
   }
+
+  @Override
+  public SegmentInfosFormat segmentInfosFormat() {
+    return infosFormat;
+  }
 }

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java?rev=1196301&r1=1196300&r2=1196301&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40Codec.java
Tue Nov  1 21:44:43 2011
@@ -20,9 +20,11 @@ package org.apache.lucene.index.codecs.l
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.DefaultDocValuesFormat;
 import org.apache.lucene.index.codecs.DefaultFieldsFormat;
+import org.apache.lucene.index.codecs.DefaultSegmentInfosFormat;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldsFormat;
 import org.apache.lucene.index.codecs.PostingsFormat;
+import org.apache.lucene.index.codecs.SegmentInfosFormat;
 import org.apache.lucene.index.codecs.perfield.PerFieldPostingsFormat;
 
 /**
@@ -37,6 +39,7 @@ import org.apache.lucene.index.codecs.pe
 public class Lucene40Codec extends Codec {
   private final FieldsFormat fieldsFormat = new DefaultFieldsFormat();
   private final DocValuesFormat docValuesFormat = new DefaultDocValuesFormat();
+  private final SegmentInfosFormat infosFormat = new DefaultSegmentInfosFormat();
   private final PostingsFormat postingsFormat = new PerFieldPostingsFormat() {
     @Override
     public PostingsFormat getPostingsFormatForField(String field) {
@@ -63,6 +66,11 @@ public class Lucene40Codec extends Codec
     return postingsFormat;
   }
   
+  @Override
+  public SegmentInfosFormat segmentInfosFormat() {
+    return infosFormat;
+  }
+
   /** Returns the postings format that should be used for writing 
    *  new segments of <code>field</code>.
    *  

Modified: lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java?rev=1196301&r1=1196300&r2=1196301&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
(original)
+++ lucene/dev/branches/lucene2621/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
Tue Nov  1 21:44:43 2011
@@ -33,9 +33,11 @@ import org.apache.lucene.index.IndexWrit
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.DefaultDocValuesFormat;
 import org.apache.lucene.index.codecs.DefaultFieldsFormat;
+import org.apache.lucene.index.codecs.DefaultSegmentInfosFormat;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldsFormat;
 import org.apache.lucene.index.codecs.PostingsFormat;
+import org.apache.lucene.index.codecs.SegmentInfosFormat;
 import org.apache.lucene.index.codecs.lucene40.Lucene40Codec;
 import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsBaseFormat;
 import org.apache.lucene.index.codecs.lucene40.Lucene40PostingsFormat;
@@ -1175,6 +1177,11 @@ public class TestAddIndexes extends Luce
     public FieldsFormat fieldsFormat() {
       return new DefaultFieldsFormat();
     }
+
+    @Override
+    public SegmentInfosFormat segmentInfosFormat() {
+      return new DefaultSegmentInfosFormat();
+    }
   }
   
   /*



Mime
View raw message