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/12/09 17:43:48 UTC

svn commit: r1212506 [1/4] - in /lucene/dev/branches/lucene3622: lucene/ lucene/contrib/memory/src/java/org/apache/lucene/index/memory/ lucene/contrib/misc/src/java/org/apache/lucene/document/ lucene/src/java/org/apache/lucene/document/ lucene/src/java...

Author: rmuir
Date: Fri Dec  9 16:43:45 2011
New Revision: 1212506

URL: http://svn.apache.org/viewvc?rev=1212506&view=rev
Log:
LUCENE-3622: fix naming issues, IDV->DV, ValueType -> DV.Type, move all DV user-facing api into .index, TypePromoter pkg-private, etc

Added:
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/DocValuesField.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocValues.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/IndexDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiDocValues.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/MultiIndexDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocFieldValues.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/PerDocFieldValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocValues.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/TypePromoter.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/TypePromoter.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/DocValuesArray.java
      - copied, changed from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/IndexDocValuesArray.java
Removed:
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/IndexDocValuesArray.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/
Modified:
    lucene/dev/branches/lucene3622/lucene/CHANGES.txt
    lucene/dev/branches/lucene3622/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
    lucene/dev/branches/lucene3622/lucene/contrib/misc/src/java/org/apache/lucene/document/LazyDocument.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/Field.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/CheckIndex.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfo.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfos.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexableField.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiFieldsEnum.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiPerDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/ParallelReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SlowMultiReaderWrapper.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/DocValuesConsumer.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/DocValuesFormat.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/DocValuesReaderBase.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/DocValuesWriterBase.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocConsumer.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene3x/Lucene3xCodec.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40DocValuesFormat.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40DocValuesProducer.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40FieldInfosReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/Bytes.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/DirectSource.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/FixedDerefBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/FixedSortedBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/FixedStraightBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/Floats.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/Ints.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/PackedIntValues.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/SortedBytesMergeUtils.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/VarDerefBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/VarSortedBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/VarStraightBytesImpl.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/lucene40/values/Writer.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/sep/SepDocValuesProducer.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/simpletext/SimpleTextFieldInfosReader.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/search/FieldComparator.java
    lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/search/similarities/Similarity.java
    lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/RandomIndexWriter.java
    lucene/dev/branches/lucene3622/lucene/src/test-framework/java/org/apache/lucene/index/codecs/mocksep/MockSepDocValuesFormat.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestAddIndexes.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestDuelingCodecs.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValues.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestDocValuesIndexing.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/index/values/TestTypePromotion.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestDocValuesScoring.java
    lucene/dev/branches/lucene3622/lucene/src/test/org/apache/lucene/search/TestSort.java
    lucene/dev/branches/lucene3622/modules/grouping/CHANGES.txt
    lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupHeadsCollector.java
    lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVAllGroupsCollector.java
    lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVFirstPassGroupingCollector.java
    lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/dv/DVSecondPassGroupingCollector.java
    lucene/dev/branches/lucene3622/modules/grouping/src/java/org/apache/lucene/search/grouping/package.html
    lucene/dev/branches/lucene3622/modules/grouping/src/test/org/apache/lucene/search/grouping/AllGroupHeadsCollectorTest.java
    lucene/dev/branches/lucene3622/modules/grouping/src/test/org/apache/lucene/search/grouping/AllGroupsCollectorTest.java
    lucene/dev/branches/lucene3622/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java
    lucene/dev/branches/lucene3622/modules/queries/src/java/org/apache/lucene/queries/function/valuesource/NumericIndexDocValueSource.java

Modified: lucene/dev/branches/lucene3622/lucene/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/CHANGES.txt?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/CHANGES.txt (original)
+++ lucene/dev/branches/lucene3622/lucene/CHANGES.txt Fri Dec  9 16:43:45 2011
@@ -497,23 +497,23 @@ New features
   bytes in RAM. (Mike McCandless)
   
 * LUCENE-3108, LUCENE-2935, LUCENE-2168, LUCENE-1231: Changes from 
-  IndexDocValues (ColumnStrideFields):
+  DocValues (ColumnStrideFields):
   
   - IndexWriter now supports typesafe dense per-document values stored in
-    a column like storage. IndexDocValues are stored on a per-document
+    a column like storage. DocValues are stored on a per-document
     basis where each documents field can hold exactly one value of a given
-    type. IndexDocValues are provided via Fieldable and can be used in
+    type. DocValues are provided via Fieldable and can be used in
     conjunction with stored and indexed values.
      
-  - IndexDocValues provides an entirely RAM resident document id to value
+  - DocValues provides an entirely RAM resident document id to value
     mapping per field as well as a DocIdSetIterator based disk-resident
     sequential access API relying on filesystem-caches.
     
   - Both APIs are exposed via IndexReader and the Codec / Flex API allowing
-    expert users to integrate customized IndexDocValues reader and writer
+    expert users to integrate customized DocValues reader and writer
     implementations by extending existing Codecs.
     
-  - IndexDocValues provides implementations for primitive datatypes like int,
+  - DocValues provides implementations for primitive datatypes like int,
     long, float, double and arrays of byte. Byte based implementations further
     provide storage variants like straight or dereferenced stored bytes, fixed
     and variable length bytes as well as index time sorted based on 

Modified: lucene/dev/branches/lucene3622/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/lucene3622/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Fri Dec  9 16:43:45 2011
@@ -40,13 +40,13 @@ import org.apache.lucene.index.DocsEnum;
 import org.apache.lucene.index.FieldInvertState;
 import org.apache.lucene.index.Fields;
 import org.apache.lucene.index.FieldsEnum;
+import org.apache.lucene.index.PerDocValues;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.OrdTermState;
 import org.apache.lucene.index.StoredFieldVisitor;
 import org.apache.lucene.index.Term;
 import org.apache.lucene.index.TermState;
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.index.Terms;
 import org.apache.lucene.index.TermsEnum;
 import org.apache.lucene.search.Collector;

Modified: lucene/dev/branches/lucene3622/lucene/contrib/misc/src/java/org/apache/lucene/document/LazyDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/contrib/misc/src/java/org/apache/lucene/document/LazyDocument.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/contrib/misc/src/java/org/apache/lucene/document/LazyDocument.java (original)
+++ lucene/dev/branches/lucene3622/lucene/contrib/misc/src/java/org/apache/lucene/document/LazyDocument.java Fri Dec  9 16:43:45 2011
@@ -28,8 +28,8 @@ import org.apache.lucene.index.FieldInfo
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexableField;
 import org.apache.lucene.index.IndexableFieldType;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.PerDocFieldValues;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.util.BytesRef;
 
 /** Defers actually loading a field's value until you ask
@@ -166,7 +166,7 @@ public class LazyDocument {
     }
 
     @Override
-    public ValueType docValuesType() {
+    public DocValues.Type docValuesType() {
       if (num == 0) {
         return getDocument().getField(name).docValuesType();
       } else {

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/DocValuesField.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/DocValuesField.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/DocValuesField.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/IndexDocValuesField.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/DocValuesField.java Fri Dec  9 16:43:45 2011
@@ -20,8 +20,9 @@ import java.io.Reader;
 import java.util.Comparator;
 
 import org.apache.lucene.index.IndexableFieldType;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.PerDocFieldValues;
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
 import org.apache.lucene.util.BytesRef;
 
 /**
@@ -31,14 +32,14 @@ import org.apache.lucene.util.BytesRef;
  * example usage, adding an int value:
  * 
  * <pre>
- * document.add(new IndexDocValuesField(name).setInt(value));
+ * document.add(new DocValuesField(name).setInt(value));
  * </pre>
  * 
  * For optimal performance, re-use the <code>DocValuesField</code> and
  * {@link Document} instance for more than one document:
  * 
  * <pre>
- *  IndexDocValuesField field = new IndexDocValuesField(name);
+ *  DocValuesField field = new DocValuesField(name);
  *  Document document = new Document();
  *  document.add(field);
  * 
@@ -56,7 +57,7 @@ import org.apache.lucene.util.BytesRef;
  * when creating the field:
  * 
  * <pre>
- *  IndexDocValuesField field = new IndexDocValuesField(name, StringField.TYPE_STORED);
+ *  DocValuesField field = new DocValuesField(name, StringField.TYPE_STORED);
  *  Document document = new Document();
  *  document.add(field);
  *  for(all documents) {
@@ -68,27 +69,26 @@ import org.apache.lucene.util.BytesRef;
  * </pre>
  * 
  * */
-// TODO: maybe rename to DocValuesField?
-public class IndexDocValuesField extends Field implements PerDocFieldValues {
+public class DocValuesField extends Field implements PerDocFieldValues {
 
   protected BytesRef bytes;
   protected double doubleValue;
   protected long longValue;
-  protected ValueType type;
+  protected DocValues.Type type;
   protected Comparator<BytesRef> bytesComparator;
 
   /**
-   * Creates a new {@link IndexDocValuesField} with the given name.
+   * Creates a new {@link DocValuesField} with the given name.
    */
-  public IndexDocValuesField(String name) {
+  public DocValuesField(String name) {
     this(name, new FieldType());
   }
 
-  public IndexDocValuesField(String name, IndexableFieldType type) {
+  public DocValuesField(String name, IndexableFieldType type) {
     this(name, type, null);
   }
 
-  public IndexDocValuesField(String name, IndexableFieldType type, String value) {
+  public DocValuesField(String name, IndexableFieldType type, String value) {
     super(name, type);
     fieldsData = value;
   }
@@ -99,9 +99,9 @@ public class IndexDocValuesField extends
   }
 
   /**
-   * Sets the given <code>long</code> value and sets the field's {@link ValueType} to
-   * {@link ValueType#VAR_INTS} unless already set. If you want to change the
-   * default type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>long</code> value and sets the field's {@link Type} to
+   * {@link Type#VAR_INTS} unless already set. If you want to change the
+   * default type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setInt(long value) {
     setInt(value, false);
@@ -113,20 +113,20 @@ public class IndexDocValuesField extends
    * @param value
    *          the value to set
    * @param fixed
-   *          if <code>true</code> {@link ValueType#FIXED_INTS_64} is used
-   *          otherwise {@link ValueType#VAR_INTS}
+   *          if <code>true</code> {@link Type#FIXED_INTS_64} is used
+   *          otherwise {@link Type#VAR_INTS}
    */
   public void setInt(long value, boolean fixed) {
     if (type == null) {
-      type = fixed ? ValueType.FIXED_INTS_64 : ValueType.VAR_INTS;
+      type = fixed ? DocValues.Type.FIXED_INTS_64 : DocValues.Type.VAR_INTS;
     }
     longValue = value;
   }
 
   /**
-   * Sets the given <code>int</code> value and sets the field's {@link ValueType} to
-   * {@link ValueType#VAR_INTS} unless already set. If you want to change the
-   * default type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>int</code> value and sets the field's {@link Type} to
+   * {@link Type#VAR_INTS} unless already set. If you want to change the
+   * default type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setInt(int value) {
     setInt(value, false);
@@ -138,20 +138,20 @@ public class IndexDocValuesField extends
    * @param value
    *          the value to set
    * @param fixed
-   *          if <code>true</code> {@link ValueType#FIXED_INTS_32} is used
-   *          otherwise {@link ValueType#VAR_INTS}
+   *          if <code>true</code> {@link Type#FIXED_INTS_32} is used
+   *          otherwise {@link Type#VAR_INTS}
    */
   public void setInt(int value, boolean fixed) {
     if (type == null) {
-      type = fixed ? ValueType.FIXED_INTS_32 : ValueType.VAR_INTS;
+      type = fixed ? DocValues.Type.FIXED_INTS_32 : DocValues.Type.VAR_INTS;
     }
     longValue = value;
   }
 
   /**
-   * Sets the given <code>short</code> value and sets the field's {@link ValueType} to
-   * {@link ValueType#VAR_INTS} unless already set. If you want to change the
-   * default type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>short</code> value and sets the field's {@link Type} to
+   * {@link Type#VAR_INTS} unless already set. If you want to change the
+   * default type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setInt(short value) {
     setInt(value, false);
@@ -163,20 +163,20 @@ public class IndexDocValuesField extends
    * @param value
    *          the value to set
    * @param fixed
-   *          if <code>true</code> {@link ValueType#FIXED_INTS_16} is used
-   *          otherwise {@link ValueType#VAR_INTS}
+   *          if <code>true</code> {@link Type#FIXED_INTS_16} is used
+   *          otherwise {@link Type#VAR_INTS}
    */
   public void setInt(short value, boolean fixed) {
     if (type == null) {
-      type = fixed ? ValueType.FIXED_INTS_16 : ValueType.VAR_INTS;
+      type = fixed ? DocValues.Type.FIXED_INTS_16 : DocValues.Type.VAR_INTS;
     }
     longValue = value;
   }
 
   /**
-   * Sets the given <code>byte</code> value and sets the field's {@link ValueType} to
-   * {@link ValueType#VAR_INTS} unless already set. If you want to change the
-   * default type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>byte</code> value and sets the field's {@link Type} to
+   * {@link Type#VAR_INTS} unless already set. If you want to change the
+   * default type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setInt(byte value) {
     setInt(value, false);
@@ -188,59 +188,59 @@ public class IndexDocValuesField extends
    * @param value
    *          the value to set
    * @param fixed
-   *          if <code>true</code> {@link ValueType#FIXED_INTS_8} is used
-   *          otherwise {@link ValueType#VAR_INTS}
+   *          if <code>true</code> {@link Type#FIXED_INTS_8} is used
+   *          otherwise {@link Type#VAR_INTS}
    */
   public void setInt(byte value, boolean fixed) {
     if (type == null) {
-      type = fixed ? ValueType.FIXED_INTS_8 : ValueType.VAR_INTS;
+      type = fixed ? DocValues.Type.FIXED_INTS_8 : DocValues.Type.VAR_INTS;
     }
     longValue = value;
   }
 
   /**
-   * Sets the given <code>float</code> value and sets the field's {@link ValueType}
-   * to {@link ValueType#FLOAT_32} unless already set. If you want to
-   * change the type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>float</code> value and sets the field's {@link Type}
+   * to {@link Type#FLOAT_32} unless already set. If you want to
+   * change the type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setFloat(float value) {
     if (type == null) {
-      type = ValueType.FLOAT_32;
+      type = DocValues.Type.FLOAT_32;
     }
     doubleValue = value;
   }
 
   /**
-   * Sets the given <code>double</code> value and sets the field's {@link ValueType}
-   * to {@link ValueType#FLOAT_64} unless already set. If you want to
-   * change the default type use {@link #setDocValuesType(ValueType)}.
+   * Sets the given <code>double</code> value and sets the field's {@link Type}
+   * to {@link Type#FLOAT_64} unless already set. If you want to
+   * change the default type use {@link #setDocValuesType(DocValues.Type)}.
    */
   public void setFloat(double value) {
     if (type == null) {
-      type = ValueType.FLOAT_64;
+      type = DocValues.Type.FLOAT_64;
     }
     doubleValue = value;
   }
 
   /**
-   * Sets the given {@link BytesRef} value and the field's {@link ValueType}. The
+   * Sets the given {@link BytesRef} value and the field's {@link Type}. The
    * comparator for this field is set to <code>null</code>. If a
    * <code>null</code> comparator is set the default comparator for the given
-   * {@link ValueType} is used.
+   * {@link Type} is used.
    */
-  public void setBytes(BytesRef value, ValueType type) {
+  public void setBytes(BytesRef value, DocValues.Type type) {
     setBytes(value, type, null);
   }
 
   /**
-   * Sets the given {@link BytesRef} value, the field's {@link ValueType} and the
+   * Sets the given {@link BytesRef} value, the field's {@link Type} and the
    * field's comparator. If the {@link Comparator} is set to <code>null</code>
-   * the default for the given {@link ValueType} is used instead.
+   * the default for the given {@link Type} is used instead.
    * 
    * @throws IllegalArgumentException
    *           if the value or the type are null
    */
-  public void setBytes(BytesRef value, ValueType type, Comparator<BytesRef> comp) {
+  public void setBytes(BytesRef value, DocValues.Type type, Comparator<BytesRef> comp) {
     if (value == null) {
       throw new IllegalArgumentException("value must not be null");
     }
@@ -283,16 +283,16 @@ public class IndexDocValuesField extends
 
   /**
    * Sets the {@link BytesRef} comparator for this field. If the field has a
-   * numeric {@link ValueType} the comparator will be ignored.
+   * numeric {@link Type} the comparator will be ignored.
    */
   public void setBytesComparator(Comparator<BytesRef> comp) {
     this.bytesComparator = comp;
   }
 
   /**
-   * Sets the {@link ValueType} for this field.
+   * Sets the {@link Type} for this field.
    */
-  public void setDocValuesType(ValueType type) {
+  public void setDocValuesType(DocValues.Type type) {
     if (type == null) {
       throw new IllegalArgumentException("Type must not be null");
     }
@@ -307,7 +307,7 @@ public class IndexDocValuesField extends
   }
 
   @Override
-  public ValueType docValuesType() {
+  public DocValues.Type docValuesType() {
     return type;
   }
 
@@ -348,21 +348,21 @@ public class IndexDocValuesField extends
     default:
       throw new IllegalArgumentException("unknown type: " + type);
     }
-    return "<" + name() + ": IndexDocValuesField " + value + ">";
+    return "<" + name() + ": DocValuesField " + value + ">";
   }
 
   /**
-   * Returns an IndexDocValuesField holding the value from
+   * Returns an DocValuesField holding the value from
    * the provided string field, as the specified type.  The
    * incoming field must have a string value.  The name, {@link
    * FieldType} and string value are carried over from the
    * incoming Field.
    */
-  public static IndexDocValuesField build(Field field, ValueType type) {
-    if (field instanceof IndexDocValuesField) {
-      return (IndexDocValuesField) field;
+  public static DocValuesField build(Field field, DocValues.Type type) {
+    if (field instanceof DocValuesField) {
+      return (DocValuesField) field;
     }
-    final IndexDocValuesField valField = new IndexDocValuesField(field.name(), field.fieldType(), field.stringValue());
+    final DocValuesField valField = new DocValuesField(field.name(), field.fieldType(), field.stringValue());
     switch (type) {
     case BYTES_FIXED_DEREF:
     case BYTES_FIXED_STRAIGHT:

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/Field.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/Field.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/Field.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/document/Field.java Fri Dec  9 16:43:45 2011
@@ -25,10 +25,10 @@ import org.apache.lucene.analysis.Analyz
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
 import org.apache.lucene.analysis.tokenattributes.OffsetAttribute;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.IndexableFieldType;
 import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.PerDocFieldValues;
 import org.apache.lucene.util.BytesRef;
 
 /**
@@ -302,7 +302,7 @@ public class Field implements IndexableF
   }
   
   @Override
-  public ValueType docValuesType() {
+  public DocValues.Type docValuesType() {
     return null;
   }
 

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/CheckIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/CheckIndex.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/CheckIndex.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/CheckIndex.java Fri Dec  9 16:43:45 2011
@@ -25,6 +25,7 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.IndexInput;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.index.DocValues.Source;
 import org.apache.lucene.index.codecs.Codec;
 import java.io.File;
 import java.io.IOException;
@@ -38,9 +39,6 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.lucene.index.codecs.BlockTreeTermsReader;
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.IndexDocValues.Source;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
@@ -1133,7 +1131,7 @@ public class CheckIndex {
         if (fieldInfo.hasDocValues()) {
           status.totalValueFields++;
           final PerDocValues perDocValues = reader.perDocValues();
-          final IndexDocValues docValues = perDocValues.docValues(fieldInfo.name);
+          final DocValues docValues = perDocValues.docValues(fieldInfo.name);
           if (docValues == null) {
             continue;
           }

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DirectoryReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DirectoryReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DirectoryReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DirectoryReader.java Fri Dec  9 16:43:45 2011
@@ -33,7 +33,6 @@ import org.apache.lucene.store.Directory
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.store.Lock;
 import org.apache.lucene.store.LockObtainFailedException;
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.InfoStream;

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java Fri Dec  9 16:43:45 2011
@@ -30,8 +30,7 @@ import org.apache.lucene.index.codecs.Do
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.index.codecs.FieldInfosWriter;
 import org.apache.lucene.index.codecs.PerDocConsumer;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.IOUtils;
@@ -311,12 +310,12 @@ final class DocFieldProcessor extends Do
   final private Map<String, DocValuesConsumerAndDocID> docValues = new HashMap<String, DocValuesConsumerAndDocID>();
   final private Map<Integer, PerDocConsumer> perDocConsumers = new HashMap<Integer, PerDocConsumer>();
 
-  DocValuesConsumer docValuesConsumer(ValueType valueType, DocState docState, FieldInfo fieldInfo) 
+  DocValuesConsumer docValuesConsumer(DocValues.Type valueType, DocState docState, FieldInfo fieldInfo) 
       throws IOException {
     DocValuesConsumerAndDocID docValuesConsumerAndDocID = docValues.get(fieldInfo.name);
     if (docValuesConsumerAndDocID != null) {
       if (docState.docID == docValuesConsumerAndDocID.docID) {
-        throw new IllegalArgumentException("IndexDocValuesField \"" + fieldInfo.name + "\" appears more than once in this document (only one value is allowed, per field)");
+        throw new IllegalArgumentException("DocValuesField \"" + fieldInfo.name + "\" appears more than once in this document (only one value is allowed, per field)");
       }
       assert docValuesConsumerAndDocID.docID < docState.docID;
       docValuesConsumerAndDocID.docID = docState.docID;

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocValues.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/IndexDocValues.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocValues.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocValues.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/IndexDocValues.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/IndexDocValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/DocValues.java Fri Dec  9 16:43:45 2011
@@ -1,4 +1,4 @@
-package org.apache.lucene.index.values;
+package org.apache.lucene.index;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -20,43 +20,40 @@ import java.io.Closeable;
 import java.io.IOException;
 import java.util.Comparator;
 
-import org.apache.lucene.document.IndexDocValuesField;
-import org.apache.lucene.index.Fields;
-import org.apache.lucene.index.FieldsEnum;
-import org.apache.lucene.index.IndexReader;
+import org.apache.lucene.document.DocValuesField;
 import org.apache.lucene.index.codecs.DocValuesFormat;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.packed.PackedInts;
 
 /**
- * {@link IndexDocValues} provides a dense per-document typed storage for fast
- * value access based on the lucene internal document id. {@link IndexDocValues}
+ * {@link DocValues} provides a dense per-document typed storage for fast
+ * value access based on the lucene internal document id. {@link DocValues}
  * exposes two distinct APIs:
  * <ul>
  * <li>via {@link #getSource()} providing RAM resident random access</li>
  * <li>via {@link #getDirectSource()} providing on disk random access</li>
- * </ul> {@link IndexDocValues} are exposed via
+ * </ul> {@link DocValues} are exposed via
  * {@link IndexReader#perDocValues()} on a per-segment basis. For best
- * performance {@link IndexDocValues} should be consumed per-segment just like
+ * performance {@link DocValues} should be consumed per-segment just like
  * IndexReader.
  * <p>
- * {@link IndexDocValues} are fully integrated into the {@link DocValuesFormat} API.
+ * {@link DocValues} are fully integrated into the {@link DocValuesFormat} API.
  * 
- * @see ValueType for limitations and default implementation documentation
- * @see IndexDocValuesField for adding values to the index
+ * @see Type for limitations and default implementation documentation
+ * @see DocValuesField for adding values to the index
  * @see DocValuesFormat#docsConsumer(org.apache.lucene.index.PerDocWriteState) for
  *      customization
  * @lucene.experimental
  */
-public abstract class IndexDocValues implements Closeable {
+public abstract class DocValues implements Closeable {
 
-  public static final IndexDocValues[] EMPTY_ARRAY = new IndexDocValues[0];
+  public static final DocValues[] EMPTY_ARRAY = new DocValues[0];
 
   private volatile SourceCache cache = new SourceCache.DirectSourceCache();
   private final Object cacheLock = new Object();
   
   /**
-   * Loads a new {@link Source} instance for this {@link IndexDocValues} field
+   * Loads a new {@link Source} instance for this {@link DocValues} field
    * instance. Source instances returned from this method are not cached. It is
    * the callers responsibility to maintain the instance and release its
    * resources once the source is not needed anymore.
@@ -76,9 +73,9 @@ public abstract class IndexDocValues imp
    * instance unless it is not needed for the rest of its life time.
    * <p>
    * {@link Source} instances obtained from this method are closed / released
-   * from the cache once this {@link IndexDocValues} instance is closed by the
+   * from the cache once this {@link DocValues} instance is closed by the
    * {@link IndexReader}, {@link Fields} or {@link FieldsEnum} the
-   * {@link IndexDocValues} was created from.
+   * {@link DocValues} was created from.
    */
   public Source getSource() throws IOException {
     return cache.load(this);
@@ -91,14 +88,14 @@ public abstract class IndexDocValues imp
   public abstract Source getDirectSource() throws IOException;
 
   /**
-   * Returns the {@link ValueType} of this {@link IndexDocValues} instance
+   * Returns the {@link Type} of this {@link DocValues} instance
    */
-  public abstract ValueType type();
+  public abstract Type type();
 
   /**
-   * Closes this {@link IndexDocValues} instance. This method should only be called
-   * by the creator of this {@link IndexDocValues} instance. API users should not
-   * close {@link IndexDocValues} instances.
+   * Closes this {@link DocValues} instance. This method should only be called
+   * by the creator of this {@link DocValues} instance. API users should not
+   * close {@link DocValues} instances.
    */
   public void close() throws IOException {
     cache.close(this);
@@ -116,7 +113,7 @@ public abstract class IndexDocValues imp
   }
 
   /**
-   * Sets the {@link SourceCache} used by this {@link IndexDocValues} instance. This
+   * Sets the {@link SourceCache} used by this {@link DocValues} instance. This
    * method should be called before {@link #load()} is called. All {@link Source} instances in the currently used cache will be closed
    * before the new cache is installed.
    * <p>
@@ -138,17 +135,17 @@ public abstract class IndexDocValues imp
 
   /**
    * Source of per document values like long, double or {@link BytesRef}
-   * depending on the {@link IndexDocValues} fields {@link ValueType}. Source
+   * depending on the {@link DocValues} fields {@link Type}. Source
    * implementations provide random access semantics similar to array lookups
    * <p>
-   * @see IndexDocValues#getSource()
-   * @see IndexDocValues#getDirectSource()
+   * @see DocValues#getSource()
+   * @see DocValues#getDirectSource()
    */
   public static abstract class Source {
     
-    protected final ValueType type;
+    protected final Type type;
 
-    protected Source(ValueType type) {
+    protected Source(Type type) {
       this.type = type;
     }
     /**
@@ -189,11 +186,11 @@ public abstract class IndexDocValues imp
     }
 
     /**
-     * Returns the {@link ValueType} of this source.
+     * Returns the {@link Type} of this source.
      * 
-     * @return the {@link ValueType} of this source.
+     * @return the {@link Type} of this source.
      */
-    public ValueType type() {
+    public Type type() {
       return type;
     }
 
@@ -233,7 +230,7 @@ public abstract class IndexDocValues imp
 
     private final Comparator<BytesRef> comparator;
 
-    protected SortedSource(ValueType type, Comparator<BytesRef> comparator) {
+    protected SortedSource(Type type, Comparator<BytesRef> comparator) {
       super(type);
       this.comparator = comparator;
     }
@@ -326,7 +323,7 @@ public abstract class IndexDocValues imp
 
   /** Returns a Source that always returns default (missing)
    *  values for all documents. */
-  public static Source getDefaultSource(final ValueType type) {
+  public static Source getDefaultSource(final Type type) {
     return new Source(type) {
       @Override
       public long getInt(int docID) {
@@ -348,7 +345,7 @@ public abstract class IndexDocValues imp
 
   /** Returns a SortedSource that always returns default (missing)
    *  values for all documents. */
-  public static SortedSource getDefaultSortedSource(final ValueType type, final int size) {
+  public static SortedSource getDefaultSortedSource(final Type type, final int size) {
 
     final PackedInts.Reader docToOrd = new PackedInts.Reader() {
       @Override
@@ -422,4 +419,269 @@ public abstract class IndexDocValues imp
       }
     };
   }
+  
+  /**
+   * <code>Type</code> specifies the {@link DocValues} type for a
+   * certain field. A <code>Type</code> only defines the data type for a field
+   * while the actual implementation used to encode and decode the values depends
+   * on the the {@link DocValuesFormat#docsConsumer} and {@link DocValuesFormat#docsProducer} methods.
+   * 
+   * @lucene.experimental
+   */
+  public static enum Type {
+
+    /**
+     * A variable bit signed integer value. By default this type uses
+     * {@link PackedInts} to compress the values, as an offset
+     * from the minimum value, as long as the value range
+     * fits into 2<sup>63</sup>-1. Otherwise,
+     * the default implementation falls back to fixed size 64bit
+     * integers ({@link #FIXED_INTS_64}).
+     * <p>
+     * NOTE: this type uses <tt>0</tt> as the default value without any
+     * distinction between provided <tt>0</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    VAR_INTS,
+    
+    /**
+     * A 8 bit signed integer value. {@link Source} instances of
+     * this type return a <tt>byte</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0</tt> as the default value without any
+     * distinction between provided <tt>0</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FIXED_INTS_8,
+    
+    /**
+     * A 16 bit signed integer value. {@link Source} instances of
+     * this type return a <tt>short</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0</tt> as the default value without any
+     * distinction between provided <tt>0</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FIXED_INTS_16,
+    
+    /**
+     * A 32 bit signed integer value. {@link Source} instances of
+     * this type return a <tt>int</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0</tt> as the default value without any
+     * distinction between provided <tt>0</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0</tt> instead. 
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FIXED_INTS_32,
+
+    /**
+     * A 64 bit signed integer value. {@link Source} instances of
+     * this type return a <tt>long</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0</tt> as the default value without any
+     * distinction between provided <tt>0</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FIXED_INTS_64,
+    /**
+     * A 32 bit floating point value. By default there is no compression
+     * applied. To fit custom float values into less than 32bit either a custom
+     * implementation is needed or values must be encoded into a
+     * {@link #BYTES_FIXED_STRAIGHT} type. {@link Source} instances of
+     * this type return a <tt>float</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0.0f</tt> as the default value without any
+     * distinction between provided <tt>0.0f</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0.0f</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FLOAT_32,
+    /**
+     * 
+     * A 64 bit floating point value. By default there is no compression
+     * applied. To fit custom float values into less than 64bit either a custom
+     * implementation is needed or values must be encoded into a
+     * {@link #BYTES_FIXED_STRAIGHT} type. {@link Source} instances of
+     * this type return a <tt>double</tt> array from {@link Source#getArray()}
+     * <p>
+     * NOTE: this type uses <tt>0.0d</tt> as the default value without any
+     * distinction between provided <tt>0.0d</tt> values during indexing. All
+     * documents without an explicit value will use <tt>0.0d</tt> instead.
+     * Custom default values must be assigned explicitly.
+     * </p>
+     */
+    FLOAT_64,
+
+    // TODO(simonw): -- shouldn't lucene decide/detect straight vs
+    // deref, as well fixed vs var?
+    /**
+     * A fixed length straight byte[]. All values added to
+     * such a field must be of the same length. All bytes are stored sequentially
+     * for fast offset access.
+     * <p>
+     * NOTE: this type uses <tt>0 byte</tt> filled byte[] based on the length of the first seen
+     * value as the default value without any distinction between explicitly
+     * provided values during indexing. All documents without an explicit value
+     * will use the default instead.Custom default values must be assigned explicitly.
+     * </p>
+     */
+    BYTES_FIXED_STRAIGHT,
+
+    /**
+     * A fixed length dereferenced byte[] variant. Fields with
+     * this type only store distinct byte values and store an additional offset
+     * pointer per document to dereference the shared byte[].
+     * Use this type if your documents may share the same byte[].
+     * <p>
+     * NOTE: Fields of this type will not store values for documents without and
+     * explicitly provided value. If a documents value is accessed while no
+     * explicit value is stored the returned {@link BytesRef} will be a 0-length
+     * reference. Custom default values must be assigned explicitly.
+     * </p>
+     */
+    BYTES_FIXED_DEREF,
+
+    /**
+     * Variable length straight stored byte[] variant. All bytes are
+     * stored sequentially for compactness. Usage of this type via the
+     * disk-resident API might yield performance degradation since no additional
+     * index is used to advance by more than one document value at a time.
+     * <p>
+     * NOTE: Fields of this type will not store values for documents without an
+     * explicitly provided value. If a documents value is accessed while no
+     * explicit value is stored the returned {@link BytesRef} will be a 0-length
+     * byte[] reference. Custom default values must be assigned explicitly.
+     * </p>
+     */
+    BYTES_VAR_STRAIGHT,
+
+    /**
+     * A variable length dereferenced byte[]. Just like
+     * {@link #BYTES_FIXED_DEREF}, but allowing each
+     * document's value to be a different length.
+     * <p>
+     * NOTE: Fields of this type will not store values for documents without and
+     * explicitly provided value. If a documents value is accessed while no
+     * explicit value is stored the returned {@link BytesRef} will be a 0-length
+     * reference. Custom default values must be assigned explicitly.
+     * </p>
+     */
+    BYTES_VAR_DEREF,
+
+
+    /**
+     * A variable length pre-sorted byte[] variant. Just like
+     * {@link #BYTES_FIXED_SORTED}, but allowing each
+     * document's value to be a different length.
+     * <p>
+     * NOTE: Fields of this type will not store values for documents without and
+     * explicitly provided value. If a documents value is accessed while no
+     * explicit value is stored the returned {@link BytesRef} will be a 0-length
+     * reference.Custom default values must be assigned explicitly.
+     * </p>
+     * 
+     * @see SortedSource
+     */
+    BYTES_VAR_SORTED,
+    
+    /**
+     * A fixed length pre-sorted byte[] variant. Fields with this type only
+     * store distinct byte values and store an additional offset pointer per
+     * document to dereference the shared byte[]. The stored
+     * byte[] is presorted, by default by unsigned byte order,
+     * and allows access via document id, ordinal and by-value.
+     * Use this type if your documents may share the same byte[].
+     * <p>
+     * NOTE: Fields of this type will not store values for documents without and
+     * explicitly provided value. If a documents value is accessed while no
+     * explicit value is stored the returned {@link BytesRef} will be a 0-length
+     * reference. Custom default values must be assigned
+     * explicitly.
+     * </p>
+     * 
+     * @see SortedSource
+     */
+    BYTES_FIXED_SORTED
+    
+  }
+  
+  /**
+   * Abstract base class for {@link DocValues} {@link Source} cache.
+   * <p>
+   * {@link Source} instances loaded via {@link DocValues#load()} are entirely memory resident
+   * and need to be maintained by the caller. Each call to
+   * {@link DocValues#load()} will cause an entire reload of
+   * the underlying data. Source instances obtained from
+   * {@link DocValues#getSource()} and {@link DocValues#getSource()}
+   * respectively are maintained by a {@link SourceCache} that is closed (
+   * {@link #close(DocValues)}) once the {@link IndexReader} that created the
+   * {@link DocValues} instance is closed.
+   * <p>
+   * Unless {@link Source} instances are managed by another entity it is
+   * recommended to use the cached variants to obtain a source instance.
+   * <p>
+   * Implementation of this API must be thread-safe.
+   * 
+   * @see DocValues#setCache(SourceCache)
+   * @see DocValues#getSource()
+   * 
+   * @lucene.experimental
+   */
+  public static abstract class SourceCache {
+
+    /**
+     * Atomically loads a {@link Source} into the cache from the given
+     * {@link DocValues} and returns it iff no other {@link Source} has already
+     * been cached. Otherwise the cached source is returned.
+     * <p>
+     * This method will not return <code>null</code>
+     */
+    public abstract Source load(DocValues values) throws IOException;
+
+    /**
+     * Atomically invalidates the cached {@link Source} 
+     * instances if any and empties the cache.
+     */
+    public abstract void invalidate(DocValues values);
+
+    /**
+     * Atomically closes the cache and frees all resources.
+     */
+    public synchronized void close(DocValues values) {
+      invalidate(values);
+    }
+
+    /**
+     * Simple per {@link DocValues} instance cache implementation that holds a
+     * {@link Source} a member variable.
+     * <p>
+     * If a {@link DirectSourceCache} instance is closed or invalidated the cached
+     * reference are simply set to <code>null</code>
+     */
+    public static final class DirectSourceCache extends SourceCache {
+      private Source ref;
+
+      public synchronized Source load(DocValues values) throws IOException {
+        if (ref == null) {
+          ref = values.load();
+        }
+        return ref;
+      }
+
+      public synchronized void invalidate(DocValues values) {
+        ref = null;
+      }
+    }
+  }
 }

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfo.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfo.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfo.java Fri Dec  9 16:43:45 2011
@@ -1,6 +1,6 @@
 package org.apache.lucene.index;
 
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +25,7 @@ public final class FieldInfo {
   public final int number;
 
   public boolean isIndexed;
-  private ValueType docValues;
+  private DocValues.Type docValues;
 
 
   // true if term vector for this field should be stored
@@ -57,7 +57,7 @@ public final class FieldInfo {
    */
   public FieldInfo(String name, boolean isIndexed, int number, boolean storeTermVector, 
             boolean storePositionWithTermVector,  boolean storeOffsetWithTermVector, 
-            boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValues) {
+            boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValues.Type docValues) {
     this.name = name;
     this.isIndexed = isIndexed;
     this.number = number;
@@ -119,13 +119,13 @@ public final class FieldInfo {
     assert this.indexOptions == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS || !this.storePayloads;
   }
 
-  void setDocValuesType(ValueType v) {
+  void setDocValuesType(DocValues.Type v) {
     if (docValues == null) {
       docValues = v;
     }
   }
   
-  public void resetDocValuesType(ValueType v) {
+  public void resetDocValuesType(DocValues.Type v) {
     if (docValues != null) {
       docValues = v;
     }
@@ -135,7 +135,7 @@ public final class FieldInfo {
     return docValues != null;
   }
 
-  public ValueType getDocValuesType() {
+  public DocValues.Type getDocValuesType() {
     return docValues;
   }
 

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfos.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfos.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfos.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FieldInfos.java Fri Dec  9 16:43:45 2011
@@ -25,7 +25,7 @@ import java.util.SortedMap;
 import java.util.TreeMap;
 
 import org.apache.lucene.index.FieldInfo.IndexOptions;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
 
 /** Access to the Field Info file that describes document fields and whether or
  *  not they are indexed. Each segment has a separate Field Info file. Objects
@@ -299,7 +299,7 @@ public final class FieldInfos implements
    */
   synchronized public FieldInfo addOrUpdate(String name, boolean isIndexed, boolean storeTermVector,
                        boolean storePositionWithTermVector, boolean storeOffsetWithTermVector,
-                       boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValues) {
+                       boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValues.Type docValues) {
     return addOrUpdateInternal(name, -1, isIndexed, storeTermVector, storePositionWithTermVector,
                                storeOffsetWithTermVector, omitNorms, storePayloads, indexOptions, docValues);
   }
@@ -322,7 +322,7 @@ public final class FieldInfos implements
 
   synchronized private FieldInfo addOrUpdateInternal(String name, int preferredFieldNumber, boolean isIndexed,
       boolean storeTermVector, boolean storePositionWithTermVector, boolean storeOffsetWithTermVector,
-      boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValues) {
+      boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValues.Type docValues) {
     if (globalFieldNumbers == null) {
       throw new IllegalStateException("FieldInfos are read-only, create a new instance with a global field map to make modifications to FieldInfos");
     }
@@ -351,7 +351,7 @@ public final class FieldInfos implements
    */
   private FieldInfo addInternal(String name, int fieldNumber, boolean isIndexed,
                                 boolean storeTermVector, boolean storePositionWithTermVector, 
-                                boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, ValueType docValuesType) {
+                                boolean storeOffsetWithTermVector, boolean omitNorms, boolean storePayloads, IndexOptions indexOptions, DocValues.Type docValuesType) {
     // don't check modifiable here since we use that to initially build up FIs
     if (globalFieldNumbers != null) {
       globalFieldNumbers.setIfNotSet(fieldNumber, name);

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/FilterIndexReader.java Fri Dec  9 16:43:45 2011
@@ -17,7 +17,6 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexReader.java Fri Dec  9 16:43:45 2011
@@ -28,8 +28,6 @@ import java.util.concurrent.atomic.Atomi
 
 import org.apache.lucene.document.Document;
 import org.apache.lucene.document.DocumentStoredFieldVisitor;
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues;
 import org.apache.lucene.search.FieldCache; // javadocs
 import org.apache.lucene.search.SearcherManager; // javadocs
 import org.apache.lucene.store.*;
@@ -1148,7 +1146,7 @@ public abstract class IndexReader implem
     throw new UnsupportedOperationException("This reader does not support this method.");
   }
   
-  public final IndexDocValues docValues(String field) throws IOException {
+  public final DocValues docValues(String field) throws IOException {
     ensureOpen();
     final PerDocValues perDoc = perDocValues();
     if (perDoc == null) {

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexableField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexableField.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexableField.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/IndexableField.java Fri Dec  9 16:43:45 2011
@@ -23,8 +23,7 @@ import java.io.Reader;
 import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.document.NumericField;
-import org.apache.lucene.index.values.PerDocFieldValues;
-import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.util.BytesRef;
 
 // TODO: how to handle versioning here...?
@@ -80,7 +79,7 @@ public interface IndexableField {
   public PerDocFieldValues docValues();
 
   /** DocValues type; only used if docValues is non-null */
-  public ValueType docValuesType();
+  public DocValues.Type docValuesType();
 
   /**
    * Creates the TokenStream used for indexing this field.  If appropriate,

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiDocValues.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/MultiIndexDocValues.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiDocValues.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiDocValues.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/MultiIndexDocValues.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/MultiIndexDocValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiDocValues.java Fri Dec  9 16:43:45 2011
@@ -1,4 +1,4 @@
-package org.apache.lucene.index.values;
+package org.apache.lucene.index;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -24,20 +24,20 @@ import org.apache.lucene.util.ReaderUtil
 
 /**
  * A wrapper for compound IndexReader providing access to per segment
- * {@link IndexDocValues}
+ * {@link DocValues}
  * 
  * @lucene.experimental
  * @lucene.internal
  */
-public class MultiIndexDocValues extends IndexDocValues {
+public class MultiDocValues extends DocValues {
 
   public static class DocValuesIndex {
     public final static DocValuesIndex[] EMPTY_ARRAY = new DocValuesIndex[0];
     final int start;
     final int length;
-    final IndexDocValues docValues;
+    final DocValues docValues;
 
-    public DocValuesIndex(IndexDocValues docValues, int start, int length) {
+    public DocValuesIndex(DocValues docValues, int start, int length) {
       this.docValues = docValues;
       this.start = start;
       this.length = length;
@@ -46,15 +46,15 @@ public class MultiIndexDocValues extends
 
   private DocValuesIndex[] docValuesIdx;
   private int[] starts;
-  private ValueType type;
+  private Type type;
   private int valueSize;
 
-  public MultiIndexDocValues() {
+  public MultiDocValues() {
     starts = new int[0];
     docValuesIdx = new DocValuesIndex[0];
   }
 
-  public MultiIndexDocValues(DocValuesIndex[] docValuesIdx) {
+  public MultiDocValues(DocValuesIndex[] docValuesIdx) {
     reset(docValuesIdx);
   }
 
@@ -63,7 +63,7 @@ public class MultiIndexDocValues extends
     return new MultiSource(docValuesIdx, starts, false);
   }
 
-  public IndexDocValues reset(DocValuesIndex[] docValuesIdx) {
+  public DocValues reset(DocValuesIndex[] docValuesIdx) {
     final int[] start = new int[docValuesIdx.length];
     TypePromoter promoter = TypePromoter.getIdentityPromoter();
     for (int i = 0; i < docValuesIdx.length; i++) {
@@ -86,11 +86,11 @@ public class MultiIndexDocValues extends
     return this;
   }
 
-  public static class EmptyDocValues extends IndexDocValues {
+  public static class EmptyDocValues extends DocValues {
     final int maxDoc;
     final Source emptySource;
 
-    public EmptyDocValues(int maxDoc, ValueType type) {
+    public EmptyDocValues(int maxDoc, Type type) {
       this.maxDoc = maxDoc;
       this.emptySource = new EmptySource(type);
     }
@@ -101,7 +101,7 @@ public class MultiIndexDocValues extends
     }
 
     @Override
-    public ValueType type() {
+    public Type type() {
       return emptySource.type();
     }
 
@@ -169,10 +169,10 @@ public class MultiIndexDocValues extends
     }
   }
 
-  // TODO: this is dup of IndexDocValues.getDefaultSource()?
+  // TODO: this is dup of DocValues.getDefaultSource()?
   private static class EmptySource extends Source {
 
-    public EmptySource(ValueType type) {
+    public EmptySource(Type type) {
       super(type);
     }
 
@@ -195,7 +195,7 @@ public class MultiIndexDocValues extends
   }
 
   @Override
-  public ValueType type() {
+  public Type type() {
     return type;
   }
 

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiFieldsEnum.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiFieldsEnum.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiFieldsEnum.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiFieldsEnum.java Fri Dec  9 16:43:45 2011
@@ -17,7 +17,6 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 
-import org.apache.lucene.index.values.MultiIndexDocValues;
 import org.apache.lucene.util.PriorityQueue;
 import org.apache.lucene.util.ReaderUtil;
 
@@ -45,7 +44,7 @@ public final  class MultiFieldsEnum exte
 
   // Re-used TermsEnum
   private final MultiTermsEnum terms;
-  private final MultiIndexDocValues docValues;
+  private final MultiDocValues docValues;
 
   private final Fields fields;
 
@@ -57,7 +56,7 @@ public final  class MultiFieldsEnum exte
     this.fields = fields;
     terms = new MultiTermsEnum(subSlices);
     queue = new FieldMergeQueue(subs.length);
-    docValues = new MultiIndexDocValues();
+    docValues = new MultiDocValues();
     top = new FieldsEnumWithSlice[subs.length];
     List<FieldsEnumWithSlice> enumWithSlices = new ArrayList<FieldsEnumWithSlice>();
 

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiPerDocValues.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiPerDocValues.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiPerDocValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiPerDocValues.java Fri Dec  9 16:43:45 2011
@@ -17,17 +17,12 @@ package org.apache.lucene.index;
  */
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.TreeSet;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.MultiIndexDocValues;
-import org.apache.lucene.index.values.ValueType;
-import org.apache.lucene.index.values.MultiIndexDocValues.DocValuesIndex;
+import org.apache.lucene.index.MultiDocValues.DocValuesIndex;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.ReaderUtil;
 import org.apache.lucene.util.ReaderUtil.Gather;
@@ -48,7 +43,7 @@ import org.apache.lucene.util.ReaderUtil
 public class MultiPerDocValues extends PerDocValues {
   private final PerDocValues[] subs;
   private final ReaderUtil.Slice[] subSlices;
-  private final Map<String, IndexDocValues> docValues = new ConcurrentHashMap<String, IndexDocValues>();
+  private final Map<String, DocValues> docValues = new ConcurrentHashMap<String, DocValues>();
 
   public MultiPerDocValues(PerDocValues[] subs, ReaderUtil.Slice[] subSlices) {
     this.subs = subs;
@@ -106,40 +101,40 @@ public class MultiPerDocValues extends P
     return perDocValues;
   }
 
-  public IndexDocValues docValues(String field) throws IOException {
-    IndexDocValues result = docValues.get(field);
+  public DocValues docValues(String field) throws IOException {
+    DocValues result = docValues.get(field);
     if (result == null) {
       // Lazy init: first time this field is requested, we
       // create & add to docValues:
-      final List<MultiIndexDocValues.DocValuesIndex> docValuesIndex = new ArrayList<MultiIndexDocValues.DocValuesIndex>();
+      final List<MultiDocValues.DocValuesIndex> docValuesIndex = new ArrayList<MultiDocValues.DocValuesIndex>();
       int docsUpto = 0;
-      ValueType type = null;
+      DocValues.Type type = null;
       // Gather all sub-readers that share this field
       for (int i = 0; i < subs.length; i++) {
-        IndexDocValues values = subs[i].docValues(field);
+        DocValues values = subs[i].docValues(field);
         final int start = subSlices[i].start;
         final int length = subSlices[i].length;
         if (values != null) {
           if (docsUpto != start) {
             type = values.type();
-            docValuesIndex.add(new MultiIndexDocValues.DocValuesIndex(
-                new MultiIndexDocValues.EmptyDocValues(start, type), docsUpto, start
+            docValuesIndex.add(new MultiDocValues.DocValuesIndex(
+                new MultiDocValues.EmptyDocValues(start, type), docsUpto, start
                     - docsUpto));
           }
-          docValuesIndex.add(new MultiIndexDocValues.DocValuesIndex(values, start,
+          docValuesIndex.add(new MultiDocValues.DocValuesIndex(values, start,
               length));
           docsUpto = start + length;
 
         } else if (i + 1 == subs.length && !docValuesIndex.isEmpty()) {
-          docValuesIndex.add(new MultiIndexDocValues.DocValuesIndex(
-              new MultiIndexDocValues.EmptyDocValues(start, type), docsUpto, start
+          docValuesIndex.add(new MultiDocValues.DocValuesIndex(
+              new MultiDocValues.EmptyDocValues(start, type), docsUpto, start
                   - docsUpto));
         }
       }
       if (docValuesIndex.isEmpty()) {
         return null;
       }
-      result = new MultiIndexDocValues(
+      result = new MultiDocValues(
           docValuesIndex.toArray(DocValuesIndex.EMPTY_ARRAY));
       docValues.put(field, result);
     }

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/MultiReader.java Fri Dec  9 16:43:45 2011
@@ -22,7 +22,6 @@ import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.ReaderUtil;

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/ParallelReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/ParallelReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/ParallelReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/ParallelReader.java Fri Dec  9 16:43:45 2011
@@ -17,8 +17,6 @@ package org.apache.lucene.index;
  * limitations under the License.
  */
 
-import org.apache.lucene.index.codecs.PerDocValues;
-import org.apache.lucene.index.values.IndexDocValues;
 import org.apache.lucene.util.Bits;
 import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.MapBackedSet;
@@ -472,7 +470,7 @@ public class ParallelReader extends Inde
   
   // Single instance of this, per ParallelReader instance
   private static final class ParallelPerDocs extends PerDocValues {
-    final TreeMap<String,IndexDocValues> fields = new TreeMap<String,IndexDocValues>();
+    final TreeMap<String,DocValues> fields = new TreeMap<String,DocValues>();
 
     void addField(String field, IndexReader r) throws IOException {
       PerDocValues perDocs = MultiPerDocValues.getPerDocs(r);
@@ -487,7 +485,7 @@ public class ParallelReader extends Inde
     }
 
     @Override
-    public IndexDocValues docValues(String field) throws IOException {
+    public DocValues docValues(String field) throws IOException {
       return fields.get(field);
     }
   }

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocFieldValues.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/PerDocFieldValues.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocFieldValues.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocFieldValues.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/PerDocFieldValues.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/PerDocFieldValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocFieldValues.java Fri Dec  9 16:43:45 2011
@@ -1,4 +1,4 @@
-package org.apache.lucene.index.values;
+package org.apache.lucene.index;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,13 +18,15 @@ package org.apache.lucene.index.values;
  */
 import java.util.Comparator;
 
-import org.apache.lucene.document.IndexDocValuesField;
-import org.apache.lucene.index.codecs.DocValuesConsumer;
+import org.apache.lucene.document.DocValuesField;
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.DocValues.Type; // javadocs
+import org.apache.lucene.index.codecs.DocValuesConsumer; // javadocs
 import org.apache.lucene.util.BytesRef;
 
 /**
  * Per document and field values consumed by {@link DocValuesConsumer}. 
- * @see IndexDocValuesField
+ * @see DocValuesField
  * 
  * @lucene.experimental
  */
@@ -46,19 +48,19 @@ public interface PerDocFieldValues {
   public void setFloat(double value);
 
   /**
-   * Sets the given {@link BytesRef} value and the field's {@link ValueType}. The
+   * Sets the given {@link BytesRef} value and the field's {@link Type}. The
    * comparator for this field is set to <code>null</code>. If a
    * <code>null</code> comparator is set the default comparator for the given
-   * {@link ValueType} is used.
+   * {@link Type} is used.
    */
-  public void setBytes(BytesRef value, ValueType type);
+  public void setBytes(BytesRef value, DocValues.Type type);
 
   /**
-   * Sets the given {@link BytesRef} value, the field's {@link ValueType} and the
+   * Sets the given {@link BytesRef} value, the field's {@link Type} and the
    * field's comparator. If the {@link Comparator} is set to <code>null</code>
-   * the default for the given {@link ValueType} is used instead.
+   * the default for the given {@link Type} is used instead.
    */
-  public void setBytes(BytesRef value, ValueType type, Comparator<BytesRef> comp);
+  public void setBytes(BytesRef value, DocValues.Type type, Comparator<BytesRef> comp);
 
   /**
    * Returns the set {@link BytesRef} or <code>null</code> if not set.
@@ -82,17 +84,17 @@ public interface PerDocFieldValues {
 
   /**
    * Sets the {@link BytesRef} comparator for this field. If the field has a
-   * numeric {@link ValueType} the comparator will be ignored.
+   * numeric {@link Type} the comparator will be ignored.
    */
   public void setBytesComparator(Comparator<BytesRef> comp);
 
   /**
-   * Sets the {@link ValueType}
+   * Sets the {@link Type}
    */
-  public void setDocValuesType(ValueType type);
+  public void setDocValuesType(DocValues.Type type);
 
   /**
-  * Returns the {@link ValueType}
+  * Returns the {@link Type}
   */
-  public ValueType docValuesType();
+  public DocValues.Type docValuesType();
 }

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocValues.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocValues.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocValues.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocValues.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocValues.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/codecs/PerDocValues.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/PerDocValues.java Fri Dec  9 16:43:45 2011
@@ -1,4 +1,4 @@
-package org.apache.lucene.index.codecs;
+package org.apache.lucene.index;
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -18,7 +18,8 @@ package org.apache.lucene.index.codecs;
 import java.io.Closeable;
 import java.io.IOException;
 
-import org.apache.lucene.index.values.IndexDocValues;
+import org.apache.lucene.index.codecs.PerDocConsumer;
+import org.apache.lucene.index.codecs.PostingsFormat;
 
 /**
  * Abstract API that provides access to one or more per-document storage
@@ -34,15 +35,15 @@ import org.apache.lucene.index.values.In
  */
 public abstract class PerDocValues implements Closeable {
   /**
-   * Returns {@link IndexDocValues} for the current field.
+   * Returns {@link DocValues} for the current field.
    * 
    * @param field
    *          the field name
-   * @return the {@link IndexDocValues} for this field or <code>null</code> if not
+   * @return the {@link DocValues} for this field or <code>null</code> if not
    *         applicable.
    * @throws IOException
    */
-  public abstract IndexDocValues docValues(String field) throws IOException;
+  public abstract DocValues docValues(String field) throws IOException;
 
   public static final PerDocValues[] EMPTY_ARRAY = new PerDocValues[0];
 }

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentCoreReaders.java Fri Dec  9 16:43:45 2011
@@ -25,7 +25,6 @@ import org.apache.lucene.index.codecs.No
 import org.apache.lucene.index.codecs.PostingsFormat;
 import org.apache.lucene.index.codecs.FieldsProducer;
 import org.apache.lucene.index.codecs.StoredFieldsReader;
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.index.codecs.TermVectorsReader;
 import org.apache.lucene.store.CompoundFileDirectory;
 import org.apache.lucene.store.Directory;

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentMerger.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentMerger.java Fri Dec  9 16:43:45 2011
@@ -26,6 +26,7 @@ import java.util.Map;
 
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.IndexReader.FieldOption;
+import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.codecs.Codec;
 import org.apache.lucene.index.codecs.FieldInfosWriter;
 import org.apache.lucene.index.codecs.FieldsConsumer;
@@ -33,9 +34,6 @@ import org.apache.lucene.index.codecs.No
 import org.apache.lucene.index.codecs.StoredFieldsWriter;
 import org.apache.lucene.index.codecs.PerDocConsumer;
 import org.apache.lucene.index.codecs.TermVectorsWriter;
-import org.apache.lucene.index.values.IndexDocValues;
-import org.apache.lucene.index.values.TypePromoter;
-import org.apache.lucene.index.values.ValueType;
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.Bits;
@@ -191,7 +189,7 @@ final class SegmentMerger {
   
   // returns an updated typepromoter (tracking type and size) given a previous one,
   // and a newly encountered docvalues
-  private TypePromoter mergeDocValuesType(TypePromoter previous, IndexDocValues docValues) {
+  private TypePromoter mergeDocValuesType(TypePromoter previous, DocValues docValues) {
     TypePromoter incoming = TypePromoter.create(docValues.type(),  docValues.getValueSize());
     if (previous == null) {
       previous = TypePromoter.getIdentityPromoter();
@@ -199,7 +197,7 @@ final class SegmentMerger {
     TypePromoter promoted = previous.promote(incoming);
     if (promoted == null) {
       // type is incompatible: promote to BYTES_VAR_STRAIGHT
-      return TypePromoter.create(ValueType.BYTES_VAR_STRAIGHT, TypePromoter.VAR_TYPE_VALUE_SIZE);
+      return TypePromoter.create(DocValues.Type.BYTES_VAR_STRAIGHT, TypePromoter.VAR_TYPE_VALUE_SIZE);
     } else {
       return promoted;
     }
@@ -237,7 +235,7 @@ final class SegmentMerger {
         mergeState.fieldInfos.addOrUpdate(dvNames, false);
         for (String dvName : dvNames) {
           FieldInfo merged = mergeState.fieldInfos.fieldInfo(dvName);
-          IndexDocValues docValues = reader.docValues(dvName);
+          DocValues docValues = reader.docValues(dvName);
           merged.setDocValuesType(docValues.type());
           TypePromoter previous = docValuesTypes.get(merged);
           docValuesTypes.put(merged, mergeDocValuesType(previous, docValues));

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentReader.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SegmentReader.java Fri Dec  9 16:43:45 2011
@@ -28,7 +28,6 @@ import java.util.concurrent.atomic.Atomi
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.codecs.StoredFieldsReader;
-import org.apache.lucene.index.codecs.PerDocValues;
 import org.apache.lucene.index.codecs.TermVectorsReader;
 import org.apache.lucene.store.IOContext;
 import org.apache.lucene.util.BitVector;

Modified: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SlowMultiReaderWrapper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SlowMultiReaderWrapper.java?rev=1212506&r1=1212505&r2=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SlowMultiReaderWrapper.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/SlowMultiReaderWrapper.java Fri Dec  9 16:43:45 2011
@@ -26,7 +26,6 @@ import org.apache.lucene.util.ReaderUtil
 
 import org.apache.lucene.index.DirectoryReader; // javadoc
 import org.apache.lucene.index.MultiReader; // javadoc
-import org.apache.lucene.index.codecs.PerDocValues;
 
 /**
  * This class forces a composite reader (eg a {@link

Copied: lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/TypePromoter.java (from r1212424, lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/TypePromoter.java)
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/TypePromoter.java?p2=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/TypePromoter.java&p1=lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/TypePromoter.java&r1=1212424&r2=1212506&rev=1212506&view=diff
==============================================================================
--- lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/values/TypePromoter.java (original)
+++ lucene/dev/branches/lucene3622/lucene/src/java/org/apache/lucene/index/TypePromoter.java Fri Dec  9 16:43:45 2011
@@ -1,4 +1,4 @@
-package org.apache.lucene.index.values;
+package org.apache.lucene.index;
 
 /**
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -19,15 +19,17 @@ package org.apache.lucene.index.values;
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.lucene.index.DocValues.Type;
+
 /**
- * Type promoter that promotes {@link IndexDocValues} during merge based on
- * their {@link ValueType} and {@link #getValueSize()}
+ * Type promoter that promotes {@link DocValues} during merge based on
+ * their {@link Type} and {@link #getValueSize()}
  * 
  * @lucene.internal
  */
-public class TypePromoter {
+class TypePromoter {
 
-  private final static Map<Integer, ValueType> FLAGS_MAP = new HashMap<Integer, ValueType>();
+  private final static Map<Integer, Type> FLAGS_MAP = new HashMap<Integer, Type>();
   private static final TypePromoter IDENTITY_PROMOTER = new IdentityTypePromoter();
   public static final int VAR_TYPE_VALUE_SIZE = -1;
 
@@ -49,7 +51,7 @@ public class TypePromoter {
   private static final int IS_32_BIT = 1 << 10 | 1 << 11;
   private static final int IS_64_BIT = 1 << 11;
 
-  private final ValueType type;
+  private final Type type;
   private final int flags;
   private final int valueSize;
 
@@ -65,7 +67,7 @@ public class TypePromoter {
   }
 
   static {
-    for (ValueType type : ValueType.values()) {
+    for (Type type : Type.values()) {
       TypePromoter create = create(type, VAR_TYPE_VALUE_SIZE);
       FLAGS_MAP.put(create.flags, type);
     }
@@ -75,13 +77,13 @@ public class TypePromoter {
    * Creates a new {@link TypePromoter}
    * 
    * @param type
-   *          the {@link ValueType} this promoter represents
+   *          the {@link Type} this promoter represents
    * @param flags
    *          the promoters flags
    * @param valueSize
    *          the value size if {@link #IS_FIXED} or <code>-1</code> otherwise.
    */
-  protected TypePromoter(ValueType type, int flags, int valueSize) {
+  protected TypePromoter(Type type, int flags, int valueSize) {
     this.type = type;
     this.flags = flags;
     this.valueSize = valueSize;
@@ -117,11 +119,11 @@ public class TypePromoter {
   }
 
   /**
-   * Returns the {@link ValueType} of this {@link TypePromoter}
+   * Returns the {@link Type} of this {@link TypePromoter}
    * 
-   * @return the {@link ValueType} of this {@link TypePromoter}
+   * @return the {@link Type} of this {@link TypePromoter}
    */
-  public ValueType type() {
+  public Type type() {
     return type;
   }
 
@@ -134,13 +136,13 @@ public class TypePromoter {
    * Creates a new {@link TypePromoter} for the given type and size per value.
    * 
    * @param type
-   *          the {@link ValueType} to create the promoter for
+   *          the {@link Type} to create the promoter for
    * @param valueSize
    *          the size per value in bytes or <code>-1</code> iff the types have
    *          variable length.
    * @return a new {@link TypePromoter}
    */
-  public static TypePromoter create(ValueType type, int valueSize) {
+  public static TypePromoter create(Type type, int valueSize) {
     if (type == null) {
       return null;
     }