lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mikemcc...@apache.org
Subject svn commit: r1230652 - in /lucene/dev/branches/lucene3453/lucene: contrib/spatial/src/test/org/apache/lucene/spatial/tier/ src/java/org/apache/lucene/codecs/ src/java/org/apache/lucene/document/ src/java/org/apache/lucene/index/ src/test/org/apache/luc...
Date Thu, 12 Jan 2012 17:23:50 GMT
Author: mikemccand
Date: Thu Jan 12 17:23:49 2012
New Revision: 1230652

URL: http://svn.apache.org/viewvc?rev=1230652&view=rev
Log:
LUCENE-3453: remove nocommits

Modified:
    lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
    lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
    lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
    lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/DocValuesField.java
    lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/Field.java
    lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/NumericField.java
    lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/index/IndexableFieldType.java
    lucene/dev/branches/lucene3453/lucene/src/test/org/apache/lucene/index/TestTypePromotion.java

Modified: lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestCartesian.java
Thu Jan 12 17:23:49 2012
@@ -23,9 +23,11 @@ import java.util.Map;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.NumericField;
 import org.apache.lucene.document.StringField;
 import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
@@ -91,6 +93,18 @@ public class TestCartesian extends Lucen
     }
   }
   
+  private static final FieldType latLongType = new FieldType();
+  static {
+    latLongType.setIndexed(true);
+    latLongType.setStored(true);
+    latLongType.setTokenized(true);
+    latLongType.setOmitNorms(true);
+    latLongType.setIndexOptions(IndexOptions.DOCS_ONLY);
+    latLongType.setNumericType(NumericField.DataType.DOUBLE);
+    latLongType.setNumericPrecisionStep(Integer.MAX_VALUE);
+    latLongType.freeze();
+  }
+  
   private void addPoint(IndexWriter writer, String name, double lat, double lng) throws IOException{
     
     Document doc = new Document();
@@ -98,8 +112,8 @@ public class TestCartesian extends Lucen
     doc.add(newField("name", name, TextField.TYPE_STORED));
     
     // convert the lat / long to lucene fields
-    doc.add(new NumericField(latField, lat, NumericField.getFieldType(NumericField.DataType.DOUBLE,
true)));
-    doc.add(new NumericField(lngField, lng, NumericField.getFieldType(NumericField.DataType.DOUBLE,
true)));
+    doc.add(new NumericField(latField, lat, latLongType));
+    doc.add(new NumericField(lngField, lng, latLongType));
     
     // add a default meta field to make searching all documents easy 
     doc.add(newField("metafile", "doc", TextField.TYPE_STORED));
@@ -107,7 +121,7 @@ public class TestCartesian extends Lucen
     int ctpsize = ctps.size();
     for (int i =0; i < ctpsize; i++){
       CartesianTierPlotter ctp = ctps.get(i);
-      doc.add(new NumericField(ctp.getTierFieldName(), ctp.getTierBoxId(lat, lng), NumericField.getFieldType(NumericField.DataType.DOUBLE,
true)));
+      doc.add(new NumericField(ctp.getTierFieldName(), ctp.getTierBoxId(lat, lng), latLongType));
       
       doc.add(newField(geoHashPrefix, GeoHashUtils.encode(lat,lng), StringField.TYPE_STORED));
     }

Modified: lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/contrib/spatial/src/test/org/apache/lucene/spatial/tier/TestDistance.java
Thu Jan 12 17:23:49 2012
@@ -20,17 +20,19 @@ import java.io.IOException;
 
 import org.apache.lucene.analysis.MockAnalyzer;
 import org.apache.lucene.document.Document;
+import org.apache.lucene.document.FieldType;
 import org.apache.lucene.document.NumericField;
 import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.IndexReader.AtomicReaderContext;
+import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.search.QueryWrapperFilter;
 import org.apache.lucene.search.MatchAllDocsQuery;
+import org.apache.lucene.search.QueryWrapperFilter;
+import org.apache.lucene.store.Directory;
 import org.apache.lucene.util.LuceneTestCase;
 import org.apache.lucene.util.ReaderUtil;
-import org.apache.lucene.store.Directory;
 
 
 public class TestDistance extends LuceneTestCase {
@@ -58,6 +60,18 @@ public class TestDistance extends Lucene
     directory.close();
     super.tearDown();
   }
+
+  private static final FieldType latLongType = new FieldType();
+  static {
+    latLongType.setIndexed(true);
+    latLongType.setStored(true);
+    latLongType.setTokenized(true);
+    latLongType.setOmitNorms(true);
+    latLongType.setIndexOptions(IndexOptions.DOCS_ONLY);
+    latLongType.setNumericType(NumericField.DataType.DOUBLE);
+    latLongType.setNumericPrecisionStep(Integer.MAX_VALUE);
+    latLongType.freeze();
+  }
   
   private void addPoint(IndexWriter writer, String name, double lat, double lng) throws IOException{
     
@@ -66,8 +80,8 @@ public class TestDistance extends Lucene
     doc.add(newField("name", name, TextField.TYPE_STORED));
     
     // convert the lat / long to lucene fields
-    doc.add(new NumericField(latField, lat, NumericField.getFieldType(NumericField.DataType.DOUBLE,
true)));
-    doc.add(new NumericField(lngField, lng, NumericField.getFieldType(NumericField.DataType.DOUBLE,
true)));
+    doc.add(new NumericField(latField, lat, latLongType));
+    doc.add(new NumericField(lngField, lng, latLongType));
     
     // add a default meta field to make searching all documents easy 
     doc.add(newField("metafile", "doc", TextField.TYPE_STORED));

Modified: lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/codecs/DocValuesConsumer.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/codecs/DocValuesConsumer.java
Thu Jan 12 17:23:49 2012
@@ -137,8 +137,10 @@ public abstract class DocValuesConsumer 
       break;
     case BYTES_FIXED_STRAIGHT:
     case BYTES_FIXED_DEREF:
+    case BYTES_FIXED_SORTED:
     case BYTES_VAR_STRAIGHT:
     case BYTES_VAR_DEREF:
+    case BYTES_VAR_SORTED:
       scratchField = new DocValuesField("", new BytesRef(), type);
       break;
     default:

Modified: lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/DocValuesField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/DocValuesField.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/DocValuesField.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/DocValuesField.java
Thu Jan 12 17:23:49 2012
@@ -16,11 +16,15 @@ package org.apache.lucene.document;
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 import java.util.Comparator;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
 
-import org.apache.lucene.index.IndexableFieldType;
-import org.apache.lucene.index.DocValues;
 import org.apache.lucene.index.DocValues.Type; // javadocs
+import org.apache.lucene.index.DocValues;
+import org.apache.lucene.index.IndexableFieldType;
 import org.apache.lucene.util.BytesRef;
 
 /**
@@ -70,122 +74,114 @@ import org.apache.lucene.util.BytesRef;
  * 
  * */
 
-// nocommit -- how to sugar this...?
-
 public class DocValuesField extends Field {
 
   protected Comparator<BytesRef> bytesComparator;
 
+  private static final Map<DocValues.Type,FieldType> types = new HashMap<DocValues.Type,FieldType>();
+  static {
+    for(DocValues.Type type : DocValues.Type.values()) {
+      final FieldType ft = new FieldType();
+      ft.setDocValueType(type);
+      ft.freeze();
+      types.put(type, ft);
+    }
+  }
+
+  private static EnumSet<Type> BYTES = EnumSet.of(
+                     Type.BYTES_FIXED_DEREF,
+                     Type.BYTES_FIXED_STRAIGHT,
+                     Type.BYTES_VAR_DEREF,
+                     Type.BYTES_VAR_STRAIGHT,
+                     Type.BYTES_FIXED_SORTED,
+                     Type.BYTES_VAR_SORTED);
+
+  private static EnumSet<Type> INTS = EnumSet.of(
+                     Type.VAR_INTS,
+                     Type.FIXED_INTS_8,
+                     Type.FIXED_INTS_16,
+                     Type.FIXED_INTS_32,
+                     Type.FIXED_INTS_64);
+
+  public static FieldType getFieldType(DocValues.Type type) {
+    return types.get(type);
+  }
+
   public DocValuesField(String name, BytesRef bytes, DocValues.Type docValueType) {
-    super(name, new FieldType());
-    // nocommit use enumset
-    if (docValueType != DocValues.Type.BYTES_FIXED_STRAIGHT &&
-        docValueType != DocValues.Type.BYTES_FIXED_DEREF &&
-        docValueType != DocValues.Type.BYTES_VAR_STRAIGHT &&
-        docValueType != DocValues.Type.BYTES_VAR_DEREF &&
-        docValueType != DocValues.Type.BYTES_FIXED_SORTED &&
-        docValueType != DocValues.Type.BYTES_VAR_SORTED) {
-      throw new IllegalArgumentException("docValueType must be BYTE_FIXED_STRAIGHT, BYTE_FIXED_DEREF,
BYTES_VAR_STRAIGHT, BYTES_VAR_DEREF, BYTES_FIXED_SORTED or BYTES_VAR_SORTED; got " + docValueType);
+    super(name, getFieldType(docValueType));
+    if (!BYTES.contains(docValueType)) {
+      throw new IllegalArgumentException("docValueType must be one of: " + BYTES + "; got
" + docValueType);
     }
     fieldsData = bytes;
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
   }
 
   public DocValuesField(String name, byte value, DocValues.Type docValueType) {
-    super(name, new FieldType());
-    // nocommit use enumset
-    if (docValueType != DocValues.Type.VAR_INTS &&
-        docValueType != DocValues.Type.FIXED_INTS_8 &&
-        docValueType != DocValues.Type.FIXED_INTS_16 &&
-        docValueType != DocValues.Type.FIXED_INTS_32 &&
-        docValueType != DocValues.Type.FIXED_INTS_64) {
-      throw new IllegalArgumentException("docValueType must be VAR_INTS, FIXED_INTS_8/16/32/64;
got " + docValueType);
-    }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
+    super(name, getFieldType(docValueType));
+    if (!INTS.contains(docValueType)) {
+      throw new IllegalArgumentException("docValueType must be one of: " + INTS +"; got "
+ docValueType);
+    }
     fieldsData = Byte.valueOf(value);
   }
 
   public DocValuesField(String name, short value, DocValues.Type docValueType) {
-    super(name, new FieldType());
-    // nocommit use enumset
-    if (docValueType != DocValues.Type.VAR_INTS &&
-        docValueType != DocValues.Type.FIXED_INTS_8 &&
-        docValueType != DocValues.Type.FIXED_INTS_16 &&
-        docValueType != DocValues.Type.FIXED_INTS_32 &&
-        docValueType != DocValues.Type.FIXED_INTS_64) {
-      throw new IllegalArgumentException("docValueType must be VAR_INTS, FIXED_INTS_8/16/32/64;
got " + docValueType);
-    }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
+    super(name, getFieldType(docValueType));
+    if (!INTS.contains(docValueType)) {
+      throw new IllegalArgumentException("docValueType must be one of: " + INTS +"; got "
+ docValueType);
+    }
     fieldsData = Short.valueOf(value);
   }
 
   public DocValuesField(String name, int value, DocValues.Type docValueType) {
-    super(name, new FieldType());
-    // nocommit use enumset
-    if (docValueType != DocValues.Type.VAR_INTS &&
-        docValueType != DocValues.Type.FIXED_INTS_8 &&
-        docValueType != DocValues.Type.FIXED_INTS_16 &&
-        docValueType != DocValues.Type.FIXED_INTS_32 &&
-        docValueType != DocValues.Type.FIXED_INTS_64) {
-      throw new IllegalArgumentException("docValueType must be VAR_INTS, FIXED_INTS_8/16/32/64;
got " + docValueType);
-    }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
+    super(name, getFieldType(docValueType));
+    if (!INTS.contains(docValueType)) {
+      throw new IllegalArgumentException("docValueType must be one of: " + INTS +"; got "
+ docValueType);
+    }
     fieldsData = Integer.valueOf(value);
   }
 
   public DocValuesField(String name, long value, DocValues.Type docValueType) {
-    super(name, new FieldType());
-    // nocommit use enumset
-    if (docValueType != DocValues.Type.VAR_INTS &&
-        docValueType != DocValues.Type.FIXED_INTS_8 &&
-        docValueType != DocValues.Type.FIXED_INTS_16 &&
-        docValueType != DocValues.Type.FIXED_INTS_32 &&
-        docValueType != DocValues.Type.FIXED_INTS_64) {
-      throw new IllegalArgumentException("docValueType must be VAR_INTS, FIXED_INTS_8/16/32/64;
got " + docValueType);
-    }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
+    super(name, getFieldType(docValueType));
+    if (!INTS.contains(docValueType)) {
+      throw new IllegalArgumentException("docValueType must be one of: " + INTS +"; got "
+ docValueType);
+    }
     fieldsData = Long.valueOf(value);
   }
 
   public DocValuesField(String name, float value, DocValues.Type docValueType) {
-    super(name, new FieldType());
+    super(name, getFieldType(docValueType));
     if (docValueType != DocValues.Type.FLOAT_32 &&
         docValueType != DocValues.Type.FLOAT_64) {
       throw new IllegalArgumentException("docValueType must be FLOAT_32/64; got " + docValueType);
     }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
     fieldsData = Float.valueOf(value);
   }
 
   public DocValuesField(String name, double value, DocValues.Type docValueType) {
-    super(name, new FieldType());
+    super(name, getFieldType(docValueType));
     if (docValueType != DocValues.Type.FLOAT_32 &&
         docValueType != DocValues.Type.FLOAT_64) {
       throw new IllegalArgumentException("docValueType must be FLOAT_32/64; got " + docValueType);
     }
-    FieldType ft = (FieldType) type;
-    ft.setDocValueType(docValueType);
-    ft.freeze();
     fieldsData = Double.valueOf(value);
   }
 
-  // nocommit need static or dynamic type checking here:
+  // nocommit maybe leave this to Field ctor...?
   public DocValuesField(String name, Object value, IndexableFieldType type) {
     super(name, type);
     if (type.docValueType() == null) {
-      throw new NullPointerException("docValueType cannot be null");
+      throw new IllegalArgumentException("docValueType cannot be null");
+    }
+    if (value == null) {
+      throw new IllegalArgumentException("value cannot be null");
+    }
+    if (BYTES.contains(type.docValueType())) {
+      if (!(value instanceof BytesRef)) {
+        throw new IllegalArgumentException("value is not a BytesRef (got: " + value.getClass()
+ ")");
+      }
+    } else {
+      if (!(value instanceof Number)) {
+        throw new IllegalArgumentException("value is not a Number (got: " + value.getClass()
+ ")");
+      }
     }
     fieldsData = value;
   }

Modified: lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/Field.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/Field.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/Field.java (original)
+++ lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/Field.java Thu
Jan 12 17:23:49 2012
@@ -67,9 +67,18 @@ public class Field implements IndexableF
   protected float boost = 1.0f;
 
   protected Field(String name, IndexableFieldType type) {
+    if (name == null) {
+      throw new IllegalArgumentException("name cannot be null");
+    }
     this.name = name;
+    if (type == null) {
+      throw new IllegalArgumentException("type cannot be null");
+    }
     this.type = type;
   }
+
+  // nocommit ctors taking Object as fieldsData...?  ctors
+  // taking numbers...?  then why have NumericField...?
   
   /**
    * Create field with Reader value.
@@ -78,6 +87,9 @@ public class Field implements IndexableF
     if (name == null) {
       throw new IllegalArgumentException("name cannot be null");
     }
+    if (type == null) {
+      throw new IllegalArgumentException("type cannot be null");
+    }
     if (reader == null) {
       throw new NullPointerException("reader cannot be null");
     }
@@ -340,8 +352,6 @@ public class Field implements IndexableF
     return boost;
   }
 
-  // nocommit move set/getInt/Float/Long up here?  or just get/setNumber
-
   /** Sets the boost factor hits on this field.  This value will be
    * multiplied into the score of all hits on this this field of this
    * document.

Modified: lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/NumericField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/NumericField.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/NumericField.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/document/NumericField.java
Thu Jan 12 17:23:49 2012
@@ -136,9 +136,6 @@ public final class NumericField extends 
   // nocommit promote to oal.index
   public static enum DataType {INT, LONG, FLOAT, DOUBLE}
 
-  // nocommit -- we can precompute static array indexed by
-  // type.ord()?  and give them names ... TYPE_INT_STORED, etc.
-
   /** @lucene.experimental */
   public static FieldType getFieldType(DataType type, boolean stored) {
     final FieldType ft = new FieldType();
@@ -152,11 +149,16 @@ public final class NumericField extends 
     return ft;
   }
 
+  private static final FieldType INT_TYPE = getFieldType(DataType.INT, false);
+  private static final FieldType LONG_TYPE = getFieldType(DataType.LONG, false);
+  private static final FieldType FLOAT_TYPE = getFieldType(DataType.FLOAT, false);
+  private static final FieldType DOUBLE_TYPE = getFieldType(DataType.DOUBLE, false);
+
   /** Creates an int NumericField with the provided value
    *  and default <code>precisionStep</code> {@link
    *  NumericUtils#PRECISION_STEP_DEFAULT} (4). */
   public NumericField(String name, int value) {
-    super(name, getFieldType(DataType.INT, false));
+    super(name, INT_TYPE);
     fieldsData = Integer.valueOf(value);
   }
 
@@ -164,7 +166,7 @@ public final class NumericField extends 
    *  and default <code>precisionStep</code> {@link
    *  NumericUtils#PRECISION_STEP_DEFAULT} (4). */
   public NumericField(String name, long value) {
-    super(name, getFieldType(DataType.LONG, false));
+    super(name, LONG_TYPE);
     fieldsData = Long.valueOf(value);
   }
 
@@ -172,7 +174,7 @@ public final class NumericField extends 
    *  and default <code>precisionStep</code> {@link
    *  NumericUtils#PRECISION_STEP_DEFAULT} (4). */
   public NumericField(String name, float value) {
-    super(name, getFieldType(DataType.FLOAT, false));
+    super(name, FLOAT_TYPE);
     fieldsData = Float.valueOf(value);
   }
 
@@ -180,7 +182,7 @@ public final class NumericField extends 
    *  and default <code>precisionStep</code> {@link
    *  NumericUtils#PRECISION_STEP_DEFAULT} (4). */
   public NumericField(String name, double value) {
-    super(name, getFieldType(DataType.DOUBLE, false));
+    super(name, DOUBLE_TYPE);
     fieldsData = Double.valueOf(value);
   }
   

Modified: lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/index/IndexableFieldType.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/index/IndexableFieldType.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/index/IndexableFieldType.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/src/java/org/apache/lucene/index/IndexableFieldType.java
Thu Jan 12 17:23:49 2012
@@ -60,5 +60,7 @@ public interface IndexableFieldType {
   public NumericField.DataType numericType();
 
   /** Precision step for numeric field. */
+  // nocommit: should this be in FT not IFT...?
+  // but... Field holds an IFT yet needs precisionStep...
   public int numericPrecisionStep();
 }

Modified: lucene/dev/branches/lucene3453/lucene/src/test/org/apache/lucene/index/TestTypePromotion.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3453/lucene/src/test/org/apache/lucene/index/TestTypePromotion.java?rev=1230652&r1=1230651&r2=1230652&view=diff
==============================================================================
--- lucene/dev/branches/lucene3453/lucene/src/test/org/apache/lucene/index/TestTypePromotion.java
(original)
+++ lucene/dev/branches/lucene3453/lucene/src/test/org/apache/lucene/index/TestTypePromotion.java
Thu Jan 12 17:23:49 2012
@@ -1,5 +1,22 @@
 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 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;
 import java.util.EnumSet;
 import java.util.Random;
@@ -19,22 +36,6 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.LuceneTestCase;
 import org.junit.Before;
 
-/**
- * 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.
- */
 public class TestTypePromotion extends LuceneTestCase {
   @Before
   public void setUp() throws Exception {
@@ -171,19 +172,25 @@ public class TestTypePromotion extends L
     final DocValuesField valField;
     switch (valueType) {
     case FIXED_INTS_8:
+      valField = new DocValuesField("promote", (byte) 0, valueType);
+      break;
     case FIXED_INTS_16:
+      valField = new DocValuesField("promote", (short) 0, valueType);
+      break;
     case FIXED_INTS_32:
-      valField =  new DocValuesField("promote", 0, valueType);
+      valField = new DocValuesField("promote", 0, valueType);
       break;
     case VAR_INTS:
+      valField = new DocValuesField("promote", 0L, valueType);
+      break;
     case FIXED_INTS_64:
-      valField =  new DocValuesField("promote", (long) 0, valueType);
+      valField = new DocValuesField("promote", (long) 0, valueType);
       break;
     case FLOAT_64:
-      valField =  new DocValuesField("promote", (double) 0, valueType);
+      valField = new DocValuesField("promote", (double) 0, valueType);
       break;
     case FLOAT_32:
-      valField =  new DocValuesField("promote", (float) 0, valueType);
+      valField = new DocValuesField("promote", (float) 0, valueType);
       break;
     case BYTES_FIXED_DEREF:
     case BYTES_FIXED_SORTED:
@@ -191,7 +198,7 @@ public class TestTypePromotion extends L
     case BYTES_VAR_DEREF:
     case BYTES_VAR_SORTED:
     case BYTES_VAR_STRAIGHT:
-      valField =  new DocValuesField("promote", new BytesRef(), valueType);
+      valField = new DocValuesField("promote", new BytesRef(), valueType);
       break;
     default:
       fail("unexpected value " + valueType);
@@ -230,7 +237,7 @@ public class TestTypePromotion extends L
         valField.setValue(nextFloat);
         break;
       case FIXED_INTS_8:
-         values[i] = (byte) i;
+        values[i] = (byte) i;
         valField.setValue((byte)values[i]);
         break;
       case BYTES_FIXED_DEREF:
@@ -297,7 +304,7 @@ public class TestTypePromotion extends L
       // once in a while use addIndexes
       Directory dir_2 = newDirectory() ;
       IndexWriter writer_2 = new IndexWriter(dir_2,
-          newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
+                       newIndexWriterConfig(TEST_VERSION_CURRENT, new MockAnalyzer(random)));
       index(writer_2,
           randomValueType(random.nextBoolean() ? UNSORTED_BYTES : SORTED_BYTES, random),
values, num_1, num_2);
       writer_2.commit();



Mime
View raw message