You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by rm...@apache.org on 2011/10/26 16:30:00 UTC

svn commit: r1189238 - in /lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs: Codec.java CodecProvider.java FieldsFormat.java

Author: rmuir
Date: Wed Oct 26 14:30:00 2011
New Revision: 1189238

URL: http://svn.apache.org/viewvc?rev=1189238&view=rev
Log:
LUCENE-3490: add placeholder classes

Added:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java   (with props)
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/FieldsFormat.java   (with props)
Modified:
    lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java

Added: 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=1189238&view=auto
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java (added)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/Codec.java Wed Oct 26 14:30:00 2011
@@ -0,0 +1,30 @@
+package org.apache.lucene.index.codecs;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+
+/**
+ * Encodes/decodes an inverted index segment
+ */
+public abstract class Codec {
+  /** Encodes/decodes postings and indexdocvalues */
+  public abstract PostingsFormat postingsFormat() throws IOException;
+  /** Encodes/decodes stored fields, term vectors, fieldinfos */
+  public abstract FieldsFormat fieldsFormat() throws IOException;
+}

Modified: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java?rev=1189238&r1=1189237&r2=1189238&view=diff
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java (original)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java Wed Oct 26 14:30:00 2011
@@ -36,13 +36,16 @@ import org.apache.lucene.store.IOContext
  *
  *  @lucene.experimental */
 
+// TODO: this class should only resolve String names to Codec instances.
+//   Its probably the case for now we will have to leave the infosReader/Writer here,
+//   but the hashmaps/field-oriented stuff must die die die
 public class CodecProvider {
   private SegmentInfosWriter infosWriter = new DefaultSegmentInfosWriter();
   private SegmentInfosReader infosReader = new DefaultSegmentInfosReader();
+  // TODO: all this stuff below needs to be private to PerFieldCodec
   private String defaultFieldCodec = "Standard";
   private final Map<String, String> perFieldMap = new HashMap<String, String>();
 
-  
   private final HashMap<String, PostingsFormat> codecs = new HashMap<String, PostingsFormat>();
 
   private final Set<String> knownExtensions = new HashSet<String>();
@@ -112,11 +115,13 @@ public class CodecProvider {
   }
   
   /** expert */
+  // TODO: nuke from here, access from fieldsFormat only!
   public FieldsReader fieldsReader(Directory directory, String segment, FieldInfos fn, IOContext context, int docStoreOffset, int size) throws IOException {
     return new DefaultFieldsReader(directory, segment, fn, context, docStoreOffset, size);
   }
 
   /** expert */
+  // TODO: nuke from here, access from fieldsFormat only!
   public FieldsWriter fieldsWriter(Directory directory, String segment, IOContext context) throws IOException {
     return new DefaultFieldsWriter(directory, segment, context);
   }

Added: lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/FieldsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/FieldsFormat.java?rev=1189238&view=auto
==============================================================================
--- lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/FieldsFormat.java (added)
+++ lucene/dev/branches/lucene2621/lucene/src/java/org/apache/lucene/index/codecs/FieldsFormat.java Wed Oct 26 14:30:00 2011
@@ -0,0 +1,32 @@
+package org.apache.lucene.index.codecs;
+
+import java.io.IOException;
+
+import org.apache.lucene.index.FieldInfos;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Controls the format of stored fields/termvectors/...
+ */
+public abstract class FieldsFormat {
+  public abstract FieldsReader fieldsReader(Directory directory, String segment, FieldInfos fn, IOContext context, int docStoreOffset, int size) throws IOException;
+  public abstract FieldsWriter fieldsWriter(Directory directory, String segment, IOContext context) throws IOException;
+}