You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2011/08/21 17:24:10 UTC

svn commit: r1159996 - in /lucene/dev/branches/fieldtype_conflicted: lucene/contrib/misc/src/test/org/apache/lucene/index/ lucene/src/java/org/apache/lucene/analysis/ lucene/src/java/org/apache/lucene/document/ lucene/src/java/org/apache/lucene/index/ ...

Author: mikemccand
Date: Sun Aug 21 15:24:10 2011
New Revision: 1159996

URL: http://svn.apache.org/viewvc?rev=1159996&view=rev
Log:
LUCENE-2308: remove nocommits, add new test, fix some inconsistent naming

Added:
    lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestIndexableField.java   (with props)
Modified:
    lucene/dev/branches/fieldtype_conflicted/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/analysis/Analyzer.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/Field.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/NumericField.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsReader.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsWriter.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexReader.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexableField.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
    lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
    lucene/dev/branches/fieldtype_conflicted/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
    lucene/dev/branches/fieldtype_conflicted/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/contrib/misc/src/test/org/apache/lucene/index/TestContribFieldsReader.java Sun Aug 21 15:24:10 2011
@@ -88,7 +88,7 @@ public class TestContribFieldsReader ext
     assertTrue("doc is null and it shouldn't be", doc != null);
     IndexableField field = doc.getField(DocHelper.LAZY_FIELD_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("field is not lazy and it should be", ((Field) field).lazy());
+    assertTrue("field is not lazy and it should be", field.getClass().getSimpleName().equals("LazyField"));
     String value = field.stringValue();
     assertTrue("value is null and it shouldn't be", value != null);
     assertTrue(value + " is not equal to " + DocHelper.LAZY_FIELD_TEXT, value.equals(DocHelper.LAZY_FIELD_TEXT) == true);
@@ -96,15 +96,15 @@ public class TestContribFieldsReader ext
 
     field = doc.getField(DocHelper.TEXT_FIELD_1_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == false);
+    assertFalse("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     field = doc.getField(DocHelper.TEXT_FIELD_UTF1_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == false);
+    assertFalse("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     assertTrue(field.stringValue() + " is not equal to " + DocHelper.FIELD_UTF1_TEXT, field.stringValue().equals(DocHelper.FIELD_UTF1_TEXT) == true);
 
     field = doc.getField(DocHelper.TEXT_FIELD_UTF2_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == true);
+    assertTrue("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     assertTrue(field.stringValue() + " is not equal to " + DocHelper.FIELD_UTF2_TEXT, field.stringValue().equals(DocHelper.FIELD_UTF2_TEXT) == true);
 
     field = doc.getField(DocHelper.LAZY_FIELD_BINARY_KEY);
@@ -153,7 +153,7 @@ public class TestContribFieldsReader ext
     assertTrue("doc is null and it shouldn't be", doc != null);
     IndexableField field = doc.getField(DocHelper.LAZY_FIELD_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("field is not lazy and it should be", ((Field) field).lazy());
+    assertTrue("field is not lazy and it should be", field.getClass().getSimpleName().equals("LazyField"));
     String value = field.stringValue();
     assertTrue("value is null and it shouldn't be", value != null);
     assertTrue(value + " is not equal to " + DocHelper.LAZY_FIELD_TEXT, value.equals(DocHelper.LAZY_FIELD_TEXT) == true);
@@ -161,18 +161,18 @@ public class TestContribFieldsReader ext
 
     field = doc.getField(DocHelper.TEXT_FIELD_1_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == false);
+    assertFalse("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     assertTrue("calling stringValue() twice should give same reference", field.stringValue() == field.stringValue());
 
     field = doc.getField(DocHelper.TEXT_FIELD_UTF1_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == false);
+    assertFalse("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     assertTrue(field.stringValue() + " is not equal to " + DocHelper.FIELD_UTF1_TEXT, field.stringValue().equals(DocHelper.FIELD_UTF1_TEXT) == true);
     assertTrue("calling stringValue() twice should give same reference", field.stringValue() == field.stringValue());
 
     field = doc.getField(DocHelper.TEXT_FIELD_UTF2_KEY);
     assertTrue("field is null and it shouldn't be", field != null);
-    assertTrue("Field is lazy and it should not be", ((Field) field).lazy() == true);
+    assertTrue("Field is lazy and it should not be", field.getClass().getSimpleName().equals("LazyField"));
     assertTrue(field.stringValue() + " is not equal to " + DocHelper.FIELD_UTF2_TEXT, field.stringValue().equals(DocHelper.FIELD_UTF2_TEXT) == true);
     assertTrue("calling stringValue() twice should give different references", field.stringValue() != field.stringValue());
 
@@ -247,7 +247,7 @@ public class TestContribFieldsReader ext
       assertTrue("doc is null and it shouldn't be", doc != null);
       IndexableField field = doc.getField(DocHelper.LARGE_LAZY_FIELD_KEY);
       assertTrue("field is null and it shouldn't be", field != null);
-      assertTrue("field is lazy", ((Field) field).lazy() == false);
+      assertFalse("field is lazy", field.getClass().getSimpleName().equals("LazyField"));
       String value;
       long start;
       long finish;
@@ -265,7 +265,7 @@ public class TestContribFieldsReader ext
       reader = IndexReader.open(tmpDir);
       doc = getDocument(reader, 0, fieldSelector);
       field = doc.getField(DocHelper.LARGE_LAZY_FIELD_KEY);
-      assertTrue("field is not lazy", ((Field) field).lazy() == true);
+      assertTrue("field is not lazy", field.getClass().getSimpleName().equals("LazyField"));
       start = System.currentTimeMillis();
       //On my machine this took around 50 - 70ms
       value = field.stringValue();

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/analysis/Analyzer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/analysis/Analyzer.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/analysis/Analyzer.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/analysis/Analyzer.java Sun Aug 21 15:24:10 2011
@@ -137,7 +137,6 @@ public abstract class Analyzer implement
    * @param field the field just indexed
    * @return offset gap, added to the next token emitted from {@link #tokenStream(String,Reader)}
    */
-  // nocommit cut to IndexableField
   public int getOffsetGap(IndexableField field) {
     if (field.tokenized()) {
       return 1;

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/Field.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/Field.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/Field.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/Field.java Sun Aug 21 15:24:10 2011
@@ -119,10 +119,6 @@ public class Field implements IndexableF
     this.fieldsData = value;
   }
 
-  public boolean isNumeric() {
-    return false;
-  }
-  
   /**
    * The value of the field as a String, or null. If null, the Reader value or
    * binary value is used. Exactly one of stringValue(), readerValue(), and
@@ -339,7 +335,7 @@ public class Field implements IndexableF
     return type.omitNorms();
   }
   
-  public IndexOptions getIndexOptions() {
+  public IndexOptions indexOptions() {
     return type.indexOptions();
   }
   
@@ -355,10 +351,6 @@ public class Field implements IndexableF
     return type.storeTermVectorPositions();
   }
   
-  public boolean lazy() {
-    return type.lazy();
-  }
-  
   /** Prints a Field for human consumption. */
   @Override
   public final String toString() {
@@ -376,7 +368,7 @@ public class Field implements IndexableF
     return result.toString();
   }
   
-  public PerDocFieldValues getDocValues() {
+  public PerDocFieldValues docValues() {
     return docValues;
   }
   

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/NumericField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/NumericField.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/NumericField.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/document/NumericField.java Sun Aug 21 15:24:10 2011
@@ -309,20 +309,11 @@ public final class NumericField extends 
     return dataType;
   }
 
-  public DataType numericType() {
-    return dataType;
-  }
-
   @Override
   public boolean numeric() {
     return true;
   }
 
-  @Override
-  public boolean isNumeric() {
-    return true;
-  }
-  
   /**
    * Initializes the field with the supplied <code>long</code> value.
    * 

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocFieldProcessor.java Sun Aug 21 15:24:10 2011
@@ -225,7 +225,7 @@ final class DocFieldProcessor extends Do
         // easily add it
         FieldInfo fi = fieldInfos.addOrUpdate(fieldName, field.indexed(), field.storeTermVectors(),
                                               field.storeTermVectorPositions(), field.storeTermVectorOffsets(),
-                                              field.omitNorms(), false, field.getIndexOptions(), field.docValuesType());
+                                              field.omitNorms(), false, field.indexOptions(), field.docValuesType());
 
         fp = new DocFieldProcessorPerField(this, fi);
         fp.next = fieldHash[hashPos];
@@ -238,7 +238,7 @@ final class DocFieldProcessor extends Do
       } else {
         fieldInfos.addOrUpdate(fp.fieldInfo.name, field.indexed(), field.storeTermVectors(),
                                field.storeTermVectorPositions(), field.storeTermVectorOffsets(),
-                               field.omitNorms(), false, field.getIndexOptions(), field.docValuesType());
+                               field.omitNorms(), false, field.indexOptions(), field.docValuesType());
       }
 
       if (thisFieldGen != fp.lastGen) {
@@ -264,7 +264,7 @@ final class DocFieldProcessor extends Do
       }
       if (field.hasDocValues()) {
         final DocValuesConsumer docValuesConsumer = docValuesConsumer(docState, fp.fieldInfo);
-        docValuesConsumer.add(docState.docID, field.getDocValues());
+        docValuesConsumer.add(docState.docID, field.docValues());
       }
     }
 

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/DocInverterPerField.java Sun Aug 21 15:24:10 2011
@@ -79,8 +79,9 @@ final class DocInverterPerField extends 
         if (i > 0)
           fieldState.position += docState.analyzer == null ? 0 : docState.analyzer.getPositionIncrementGap(fieldInfo.name);
 
-        // nocommit -- this logic should be outside of
-        // indexer
+        // TODO (LUCENE-2309): this analysis logic should be
+        // outside of indexer -- field should simply give us
+        // a TokenStream, even for multi-valued fields
 
         if (!field.tokenized()) {		  // un-tokenized field
           String stringValue = field.stringValue();

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsReader.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsReader.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsReader.java Sun Aug 21 15:24:10 2011
@@ -297,230 +297,4 @@ public final class FieldsReader implemen
   private void skipFieldBytes(int toRead) throws IOException {
     fieldsStream.seek(fieldsStream.getFilePointer() + toRead);
   }
-
-  /*
-  private NumericField loadNumericField(FieldInfo fi, int numeric) throws IOException {
-    assert numeric != 0;
-    switch(numeric) {
-      case FieldsWriter.FIELD_IS_NUMERIC_INT:
-        return new NumericField(fi.name, Field.Store.YES, fi.isIndexed).setIntValue(fieldsStream.readInt());
-      case FieldsWriter.FIELD_IS_NUMERIC_LONG:
-        return new NumericField(fi.name, Field.Store.YES, fi.isIndexed).setLongValue(fieldsStream.readLong());
-      case FieldsWriter.FIELD_IS_NUMERIC_FLOAT:
-        return new NumericField(fi.name, Field.Store.YES, fi.isIndexed).setFloatValue(Float.intBitsToFloat(fieldsStream.readInt()));
-      case FieldsWriter.FIELD_IS_NUMERIC_DOUBLE:
-        return new NumericField(fi.name, Field.Store.YES, fi.isIndexed).setDoubleValue(Double.longBitsToDouble(fieldsStream.readLong()));
-      default:
-        throw new FieldReaderException("Invalid numeric type: " + Integer.toHexString(numeric));
-    }
-  }
-  */
-  
-  /*
-  private void addFieldLazy(Document doc, FieldInfo fi, boolean binary, boolean tokenize, boolean cacheResult, int numeric) throws IOException {
-    final AbstractField f;
-    if (binary) {
-      int toRead = fieldsStream.readVInt();
-      long pointer = fieldsStream.getFilePointer();
-      f = new LazyField(fi.name, Field.Store.YES, toRead, pointer, binary, cacheResult);
-      //Need to move the pointer ahead by toRead positions
-      fieldsStream.seek(pointer + toRead);
-    } else if (numeric != 0) {
-      f = loadNumericField(fi, numeric);
-    } else {
-      Field.Store store = Field.Store.YES;
-      Field.Index index = Field.Index.toIndex(fi.isIndexed, tokenize);
-      Field.TermVector termVector = Field.TermVector.toTermVector(fi.storeTermVector, fi.storeOffsetWithTermVector, fi.storePositionWithTermVector);
-
-      int length = fieldsStream.readVInt();
-      long pointer = fieldsStream.getFilePointer();
-      //Skip ahead of where we are by the length of what is stored
-      fieldsStream.seek(pointer+length);
-      f = new LazyField(fi.name, store, index, termVector, length, pointer, binary, cacheResult);
-    }
-    
-    f.setOmitNorms(fi.omitNorms);
-    f.setIndexOptions(fi.indexOptions);
-    doc.add(f);
-  }
-
-  private void addField(Document doc, FieldInfo fi, boolean binary, boolean tokenize, int numeric) throws CorruptIndexException, IOException {
-    final AbstractField f;
-
-    if (binary) {
-      int toRead = fieldsStream.readVInt();
-      final byte[] b = new byte[toRead];
-      fieldsStream.readBytes(b, 0, b.length);
-      f = new Field(fi.name, b);
-    } else if (numeric != 0) {
-      f = loadNumericField(fi, numeric);
-    } else {
-      Field.Index index = Field.Index.toIndex(fi.isIndexed, tokenize);
-      Field.TermVector termVector = Field.TermVector.toTermVector(fi.storeTermVector, fi.storeOffsetWithTermVector, fi.storePositionWithTermVector);
-      f = new Field(fi.name,     // name
-        fieldsStream.readString(), // read value
-        Field.Store.YES,
-        index,
-        termVector);
-    }
-    
-    f.setIndexOptions(fi.indexOptions);
-    f.setOmitNorms(fi.omitNorms);
-    doc.add(f);
-  }
-  
-  // Add the size of field as a byte[] containing the 4 bytes of the integer byte size (high order byte first; char = 2 bytes)
-  // Read just the size -- caller must skip the field content to continue reading fields
-  // Return the size in bytes or chars, depending on field type
-  private int addFieldSize(Document doc, FieldInfo fi, boolean binary, int numeric) throws IOException {
-    final int bytesize, size;
-    switch(numeric) {
-      case 0:
-        size = fieldsStream.readVInt();
-        bytesize = binary ? size : 2*size;
-        break;
-      case FieldsWriter.FIELD_IS_NUMERIC_INT:
-      case FieldsWriter.FIELD_IS_NUMERIC_FLOAT:
-        size = bytesize = 4;
-        break;
-      case FieldsWriter.FIELD_IS_NUMERIC_LONG:
-      case FieldsWriter.FIELD_IS_NUMERIC_DOUBLE:
-        size = bytesize = 8;
-        break;
-      default:
-        throw new FieldReaderException("Invalid numeric type: " + Integer.toHexString(numeric));
-    }
-    byte[] sizebytes = new byte[4];
-    sizebytes[0] = (byte) (bytesize>>>24);
-    sizebytes[1] = (byte) (bytesize>>>16);
-    sizebytes[2] = (byte) (bytesize>>> 8);
-    sizebytes[3] = (byte)  bytesize      ;
-    doc.add(new Field(fi.name, sizebytes));
-    return size;
-  }
-  */
-
-  /**
-   * A Lazy implementation of Fieldable that defers loading of fields until asked for, instead of when the Document is
-   * loaded.
-   *
-  private class LazyField extends AbstractField implements Fieldable {
-    private int toRead;
-    private long pointer;
-    private final boolean cacheResult;
-
-    public LazyField(String name, Field.Store store, int toRead, long pointer, boolean isBinary, boolean cacheResult) {
-      super(name, store, Field.Index.NO, Field.TermVector.NO);
-      this.toRead = toRead;
-      this.pointer = pointer;
-      this.isBinary = isBinary;
-      this.cacheResult = cacheResult;
-      if (isBinary)
-        binaryLength = toRead;
-      lazy = true;
-    }
-
-    public LazyField(String name, Field.Store store, Field.Index index, Field.TermVector termVector, int toRead, long pointer, boolean isBinary, boolean cacheResult) {
-      super(name, store, index, termVector);
-      this.toRead = toRead;
-      this.pointer = pointer;
-      this.isBinary = isBinary;
-      this.cacheResult = cacheResult;
-      if (isBinary)
-        binaryLength = toRead;
-      lazy = true;
-    }
-
-    private IndexInput getFieldStream() {
-      IndexInput localFieldsStream = fieldsStreamTL.get();
-      if (localFieldsStream == null) {
-        localFieldsStream = (IndexInput) cloneableFieldsStream.clone();
-        fieldsStreamTL.set(localFieldsStream);
-      }
-      return localFieldsStream;
-    }
-
-     ** The value of the field as a Reader, or null.  If null, the String value,
-     * binary value, or TokenStream value is used.  Exactly one of stringValue(), 
-     * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. *
-    public Reader readerValue() {
-      ensureOpen();
-      return null;
-    }
-
-    /** The value of the field as a TokenStream, or null.  If null, the Reader value,
-     * String value, or binary value is used. Exactly one of stringValue(), 
-     * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. *
-    public TokenStream tokenStreamValue() {
-      ensureOpen();
-      return null;
-    }
-
-    /** The value of the field as a String, or null.  If null, the Reader value,
-     * binary value, or TokenStream value is used.  Exactly one of stringValue(), 
-     * readerValue(), getBinaryValue(), and tokenStreamValue() must be set. *
-    public String stringValue() {
-      ensureOpen();
-      if (isBinary)
-        return null;
-      else {
-        if (fieldsData == null) {
-          String result = null;
-          IndexInput localFieldsStream = getFieldStream();
-          try {
-            localFieldsStream.seek(pointer);
-            byte[] bytes = new byte[toRead];
-            localFieldsStream.readBytes(bytes, 0, toRead);
-            result = new String(bytes, "UTF-8");
-          } catch (IOException e) {
-            throw new FieldReaderException(e);
-          }
-          if (cacheResult == true){
-            fieldsData = result;
-          }
-          return result;
-        } else {
-          return (String) fieldsData;
-        }
-      }
-    }
-
-    @Override
-    public byte[] getBinaryValue(byte[] result) {
-      ensureOpen();
-
-      if (isBinary) {
-        if (fieldsData == null) {
-          // Allocate new buffer if result is null or too small
-          final byte[] b;
-          if (result == null || result.length < toRead)
-            b = new byte[toRead];
-          else
-            b = result;
-   
-          IndexInput localFieldsStream = getFieldStream();
-
-          // Throw this IOException since IndexReader.document does so anyway, so probably not that big of a change for people
-          // since they are already handling this exception when getting the document
-          try {
-            localFieldsStream.seek(pointer);
-            localFieldsStream.readBytes(b, 0, toRead);
-          } catch (IOException e) {
-            throw new FieldReaderException(e);
-          }
-
-          binaryOffset = 0;
-          binaryLength = toRead;
-          if (cacheResult == true){
-            fieldsData = b;
-          }
-          return b;
-        } else {
-          return (byte[]) fieldsData;
-        }
-      } else
-        return null;     
-    }
-  }
-  */
 }

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsWriter.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsWriter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/FieldsWriter.java Sun Aug 21 15:24:10 2011
@@ -140,7 +140,7 @@ final class FieldsWriter {
     int bits = 0;
     final BytesRef bytes;
     final String string;
-    // nocommit -- maybe a field should serialize itself?
+    // TODO: maybe a field should serialize itself?
     // this way we don't bake into indexer all these
     // specific encodings for different fields?  and apps
     // can customize...

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexReader.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexReader.java Sun Aug 21 15:24:10 2011
@@ -950,11 +950,6 @@ public abstract class IndexReader implem
    *  {@link DocumentStoredFieldVisitor}.  */
   public abstract void document(int docID, StoredFieldVisitor visitor) throws CorruptIndexException, IOException;
   
-  // nocommit -- the new document(int docID) API should
-  // clearly advertise that only field types/values are
-  // preserved -- index time metadata like boost, omitNorm,
-  // IndexOptions, tokenized are not preserved
-
   /**
    * Returns the stored fields of the <code>n</code><sup>th</sup>
    * <code>Document</code> in this index.  This is just
@@ -965,11 +960,19 @@ public abstract class IndexReader implem
    * may yield unspecified results. Usually this is not required, however you
    * can test if the doc is deleted by checking the {@link
    * Bits} returned from {@link MultiFields#getLiveDocs}.
+   *
+   * <b>NOTE:</b> only the content of a field is returned,
+   * if that field was stored during indexing.  Metadata
+   * like boost, omitNorm, IndexOptions, tokenized, etc.,
+   * are not preserved.
    * 
    * @throws CorruptIndexException if the index is corrupt
    * @throws IOException if there is a low-level IO error
    */
-  public org.apache.lucene.document.Document document(int docID) throws CorruptIndexException, IOException {
+  // TODO: we need a separate StoredField, so that the
+  // Document returned here contains that class not
+  // IndexableField
+  public Document document(int docID) throws CorruptIndexException, IOException {
     ensureOpen();
     final DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor();
     document(docID, visitor);

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexableField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexableField.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexableField.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/java/org/apache/lucene/index/IndexableField.java Sun Aug 21 15:24:10 2011
@@ -21,33 +21,21 @@ import java.io.Reader;
 
 import org.apache.lucene.analysis.TokenStream;
 import org.apache.lucene.document.NumericField;
-import org.apache.lucene.document.NumericField.DataType;
 import org.apache.lucene.index.FieldInfo.IndexOptions;
 import org.apache.lucene.index.values.PerDocFieldValues;
 import org.apache.lucene.index.values.ValueType;
 import org.apache.lucene.util.BytesRef;
 
-// nocommit jdocs
+// TODO: how to handle versioning here...?
 
-// nocommit maybe abstract class instead...?  or maybe we
-// have versioned interfaces over time, so indexer can
-// consume JARs w/ older doc/field impls?  IndexableField1,
-// IndexableField2, ...?
+/** Represents a single field for indexing.  IndexWriter
+ *  consumes Iterable<IndexableField> as a document.
+ *
+ *  @lucene.experimental */
 
-// nocommit maybe take this further and push analysis into Document
-
-// nocommit what to do about multi-valued fields?  really,
-// indexer should not know?
-
-// nocommit make test case showing how you can index
-// Iterable<IndexableField> that is not a Document
-// instance...
-
-/** @lucene.experimental */
 public interface IndexableField {
-  // nocommit: attrs?
-  // nocommit: doc values?
-  // nocommit: sorted?
+
+  // TODO: add attrs to this API?
 
   public String name();
 
@@ -57,39 +45,30 @@ public interface IndexableField {
   
   public boolean stored();
 
-  // nocommit -- isBinary?
   public BytesRef binaryValue(BytesRef reuse);
   public String stringValue();
   public Reader readerValue();
 
-  // nocommit -- decouple analyzers here: field impl should
-  // go and ask analyzer for the token stream, so indexer
-  // doesn't have to ask for string/reader value and then consult
-  // analyzer 
   public TokenStream tokenStreamValue();
 
   // Numeric field:
   public boolean numeric();
-  public DataType numericDataType();
+  public NumericField.DataType numericDataType();
   public Number numericValue();
 
   // If this returns true then we index this field:
   public boolean indexed();
 
-  // nocommit maybe remove?  only needed because stored
-  // fields records this!  (well, and because analysis isn't
-  // yet decoupled)
   public boolean tokenized();
   public boolean omitNorms();
-  public IndexOptions getIndexOptions();
+  public IndexOptions indexOptions();
 
   public boolean storeTermVectors();
   public boolean storeTermVectorOffsets();
   public boolean storeTermVectorPositions();
   
   // doc values
-  public PerDocFieldValues getDocValues();
-  public void setDocValues(PerDocFieldValues docValues);
   public boolean hasDocValues();  
+  public PerDocFieldValues docValues();
   public ValueType docValuesType();
-}
\ No newline at end of file
+}

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/DocHelper.java Sun Aug 21 15:24:10 2011
@@ -217,9 +217,9 @@ class DocHelper {
       if (f.indexed() && !f.storeTermVectors()) add(notermvector,f);
       if (f.stored()) add(stored,f);
       else add(unstored,f);
-      if (f.getIndexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);
+      if (f.indexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);
       if (f.omitNorms()) add(noNorms,f);
-      if (f.getIndexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);
+      if (f.indexOptions() == IndexOptions.DOCS_ONLY) add(noTf,f);
       //if (f.isLazy()) add(lazy, f);
     }
   }

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/index/RandomIndexWriter.java Sun Aug 21 15:24:10 2011
@@ -123,7 +123,7 @@ public class RandomIndexWriter implement
    * @see IndexWriter#addDocument(Iterable)
    */
   public <T extends IndexableField> void addDocument(final Iterable<T> doc) throws IOException {
-    if (doDocValues) {
+    if (doDocValues && doc instanceof Document) {
       randomPerDocFieldValues(r, (Document) doc);
     }
     if (r.nextInt(5) == 3) {

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test-framework/org/apache/lucene/util/_TestUtil.java Sun Aug 21 15:24:10 2011
@@ -426,7 +426,7 @@ public class _TestUtil {
   public static void add(Document doc, FieldInfos fieldInfos) {
     for (IndexableField field : doc) {
       fieldInfos.addOrUpdate(field.name(), field.indexed(), field.storeTermVectors(), field.storeTermVectorPositions(),
-              field.storeTermVectorOffsets(), field.omitNorms(), false, field.getIndexOptions(), field.docValuesType());
+              field.storeTermVectorOffsets(), field.omitNorms(), false, field.indexOptions(), field.docValuesType());
     }
   }
   

Modified: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestFieldsReader.java Sun Aug 21 15:24:10 2011
@@ -80,7 +80,7 @@ public class TestFieldsReader extends Lu
     assertTrue(field.storeTermVectorOffsets() == true);
     assertTrue(field.storeTermVectorPositions() == true);
     assertTrue(field.omitNorms() == false);
-    assertTrue(field.getIndexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
+    assertTrue(field.indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
 
     field = (Field) doc.getField(DocHelper.TEXT_FIELD_3_KEY);
     assertTrue(field != null);
@@ -88,7 +88,7 @@ public class TestFieldsReader extends Lu
     assertTrue(field.storeTermVectorOffsets() == false);
     assertTrue(field.storeTermVectorPositions() == false);
     assertTrue(field.omitNorms() == true);
-    assertTrue(field.getIndexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
+    assertTrue(field.indexOptions() == IndexOptions.DOCS_AND_FREQS_AND_POSITIONS);
 
     field = (Field) doc.getField(DocHelper.NO_TF_KEY);
     assertTrue(field != null);
@@ -96,7 +96,7 @@ public class TestFieldsReader extends Lu
     assertTrue(field.storeTermVectorOffsets() == false);
     assertTrue(field.storeTermVectorPositions() == false);
     assertTrue(field.omitNorms() == false);
-    assertTrue(field.getIndexOptions() == IndexOptions.DOCS_ONLY);
+    assertTrue(field.indexOptions() == IndexOptions.DOCS_ONLY);
 
     DocumentStoredFieldVisitor visitor = new DocumentStoredFieldVisitor(DocHelper.TEXT_FIELD_3_KEY);
     reader.document(0, visitor);

Added: lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestIndexableField.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestIndexableField.java?rev=1159996&view=auto
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestIndexableField.java (added)
+++ lucene/dev/branches/fieldtype_conflicted/lucene/src/test/org/apache/lucene/index/TestIndexableField.java Sun Aug 21 15:24:10 2011
@@ -0,0 +1,391 @@
+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.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.apache.lucene.analysis.Analyzer;
+import org.apache.lucene.analysis.MockAnalyzer;
+import org.apache.lucene.analysis.MockFixedLengthPayloadFilter;
+import org.apache.lucene.analysis.MockTokenizer;
+import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.analysis.Tokenizer;
+import org.apache.lucene.analysis.tokenattributes.CharTermAttribute;
+import org.apache.lucene.analysis.tokenattributes.PositionIncrementAttribute;
+import org.apache.lucene.document.BinaryField;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.FieldType;
+import org.apache.lucene.document.NumericField.DataType;
+import org.apache.lucene.document.NumericField;
+import org.apache.lucene.document.StringField;
+import org.apache.lucene.document.TextField;
+import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.codecs.preflexrw.PreFlexRWCodec;
+import org.apache.lucene.index.values.PerDocFieldValues;
+import org.apache.lucene.index.values.ValueType;
+import org.apache.lucene.search.BooleanClause;
+import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.DocIdSetIterator;
+import org.apache.lucene.search.FieldCache;
+import org.apache.lucene.search.IndexSearcher;
+import org.apache.lucene.search.NumericRangeQuery;
+import org.apache.lucene.search.PhraseQuery;
+import org.apache.lucene.search.Query;
+import org.apache.lucene.search.ScoreDoc;
+import org.apache.lucene.search.TermQuery;
+import org.apache.lucene.search.TopDocs;
+import org.apache.lucene.search.spans.SpanTermQuery;
+import org.apache.lucene.store.AlreadyClosedException;
+import org.apache.lucene.store.Directory;
+import org.apache.lucene.store.IOContext;
+import org.apache.lucene.store.IndexOutput;
+import org.apache.lucene.store.Lock;
+import org.apache.lucene.store.LockFactory;
+import org.apache.lucene.store.MockDirectoryWrapper;
+import org.apache.lucene.store.NoLockFactory;
+import org.apache.lucene.store.RAMDirectory;
+import org.apache.lucene.store.SingleInstanceLockFactory;
+import org.apache.lucene.util.BytesRef;
+import org.apache.lucene.util.CharsRef;
+import org.apache.lucene.util.LuceneTestCase;
+import org.apache.lucene.util.ThreadInterruptedException;
+import org.apache.lucene.util.UnicodeUtil;
+import org.apache.lucene.util._TestUtil;
+
+public class TestIndexableField extends LuceneTestCase {
+
+  private class MyField implements IndexableField {
+
+    private final int counter;
+
+    public MyField(int counter) {
+      this.counter = counter;
+    }
+
+    @Override
+    public String name() {
+      return "f" + counter;
+    }
+
+    @Override
+    public float boost() {
+      return 1.0f + random.nextFloat();
+    }
+  
+    @Override
+    public boolean stored() {
+      return (counter & 1) == 0 || (counter % 10) == 3;
+    }
+
+    @Override
+    public BytesRef binaryValue(BytesRef reuse) {
+      if ((counter%10) == 3) {
+        final byte[] bytes = new byte[10];
+        for(int idx=0;idx<bytes.length;idx++) {
+          bytes[idx] = (byte) (counter+idx);
+        }
+        return new BytesRef(bytes, 0, bytes.length);
+      } else {
+        return null;
+      }
+    }
+
+    @Override
+    public String stringValue() {
+      final int fieldID = counter%10;
+      if (fieldID != 3 && fieldID != 7 && fieldID != 9) {
+        return "text " + counter;
+      } else {
+        return null;
+      }
+    }
+
+    @Override
+    public Reader readerValue() {
+      if (counter%10 == 7) {
+        return new StringReader("text " + counter);
+      } else {
+        return null;
+      }
+    }
+
+    @Override
+    public TokenStream tokenStreamValue() {
+      if (numeric()) {
+        return new NumericField(name()).setIntValue(counter).tokenStreamValue();
+      } else {
+        return null;
+      }
+    }
+
+    // Numeric field:
+    @Override
+    public boolean numeric() {
+      return counter%10 == 9;
+    }
+
+    @Override
+    public DataType numericDataType() {
+      return DataType.INT;
+    }
+
+    @Override
+    public Number numericValue() {
+      return counter;
+    }
+
+    // If this returns true then we index this field:
+    @Override
+    public boolean indexed() {
+      return (counter % 10) != 3;
+    }
+
+    @Override
+    public boolean tokenized() {
+      return true;
+    }
+
+    @Override
+    public boolean omitNorms() {
+      return false;
+    }
+
+    @Override
+    public FieldInfo.IndexOptions indexOptions() {
+      return FieldInfo.IndexOptions.DOCS_AND_FREQS_AND_POSITIONS;
+    }
+
+    @Override
+    public boolean storeTermVectors() {
+      return counter % 2 == 1 && counter%10 != 9;
+    }
+
+    @Override
+    public boolean storeTermVectorOffsets() {
+      return counter % 2 == 1 && counter%10 != 9;
+    }
+
+    @Override
+    public boolean storeTermVectorPositions() {
+      return counter % 2 == 1 && counter%10 != 9;
+    }
+  
+    // TODO: randomly enable doc values
+    @Override
+    public PerDocFieldValues docValues() {
+      return null;
+    }
+
+    @Override
+    public boolean hasDocValues() {
+      return false;
+    }
+
+    @Override
+    public ValueType docValuesType() {
+      return null;
+    }
+  }
+
+  // Silly test showing how to index documents w/o using Lucene's core
+  // Document nor Field class
+  public void testArbitraryFields() throws Exception {
+
+    final Directory dir = newDirectory();
+    final RandomIndexWriter w = new RandomIndexWriter(random, dir);
+
+    final int NUM_DOCS = atLeast(27);
+    if (VERBOSE) {
+      System.out.println("TEST: " + NUM_DOCS + " docs");
+    }
+    final int[] fieldsPerDoc = new int[NUM_DOCS];
+    int baseCount = 0;
+
+    for(int docCount=0;docCount<NUM_DOCS;docCount++) {
+      final int fieldCount = _TestUtil.nextInt(random, 1, 17);
+      fieldsPerDoc[docCount] = fieldCount-1;
+
+      final int finalDocCount = docCount;
+      if (VERBOSE) {
+        System.out.println("TEST: " + fieldCount + " fields in doc " + docCount);
+      }
+
+      final int finalBaseCount = baseCount;
+      baseCount += fieldCount-1;
+
+      w.addDocument(new Iterable<IndexableField>() {
+        @Override
+        public Iterator<IndexableField> iterator() {
+          return new Iterator<IndexableField>() {
+            int fieldUpto;
+
+            @Override
+            public boolean hasNext() {
+              return fieldUpto < fieldCount;
+            }
+
+            @Override
+            public IndexableField next() {
+              assert fieldUpto < fieldCount;
+              if (fieldUpto == 0) {
+                fieldUpto = 1;
+                return newField("id", ""+finalDocCount, StringField.TYPE_STORED);
+              } else {
+                return new MyField(finalBaseCount + (fieldUpto++-1));
+              }
+            }
+
+            @Override
+            public void remove() {
+              throw new UnsupportedOperationException();
+            }
+          };
+        }
+        });
+    }
+
+    final IndexReader r = w.getReader();
+    w.close();
+
+    final IndexSearcher s = new IndexSearcher(r);
+    int counter = 0;
+    for(int id=0;id<NUM_DOCS;id++) {
+      if (VERBOSE) {
+        System.out.println("TEST: verify doc id=" + id + " (" + fieldsPerDoc[id] + " fields) counter=" + counter);
+      }
+      final TopDocs hits = s.search(new TermQuery(new Term("id", ""+id)), 1);
+      assertEquals(1, hits.totalHits);
+      final int docID = hits.scoreDocs[0].doc;
+      final Document doc = s.doc(docID);
+      final int endCounter = counter + fieldsPerDoc[id];
+      while(counter < endCounter) {
+        final String name = "f" + counter;
+        final int fieldID = counter % 10;
+
+        final boolean stored = (counter&1) == 0 || fieldID == 3;
+        final boolean binary = fieldID == 3;
+        final boolean indexed = fieldID != 3;
+        final boolean numeric = fieldID == 9;
+
+        final String stringValue;
+        if (fieldID != 3 && fieldID != 9) {
+          stringValue = "text " + counter;
+        } else {
+          stringValue = null;
+        }
+
+        // stored:
+        if (stored) {
+          IndexableField f = doc.getField(name);
+          assertNotNull("doc " + id + " doesn't have field f" + counter, f);
+          if (binary) {
+            assertNotNull("doc " + id + " doesn't have field f" + counter, f);
+            final BytesRef b = f.binaryValue(null);
+            assertNotNull(b);
+            assertEquals(10, b.length);
+            for(int idx=0;idx<10;idx++) {
+              assertEquals((byte) (idx+counter), b.bytes[b.offset+idx]);
+            }
+          } else if (numeric) {
+            assertTrue(f instanceof NumericField);
+            final NumericField nf = (NumericField) f;
+            assertEquals(NumericField.DataType.INT, nf.numericDataType());
+            assertEquals(counter, nf.numericValue().intValue());
+          } else {
+            assert stringValue != null;
+            assertEquals(stringValue, f.stringValue());
+          }
+        }
+        
+        if (indexed) {
+          final boolean tv = counter % 2 == 1 && fieldID != 9;
+          final TermFreqVector tfv = r.getTermFreqVector(docID, name);
+          if (tv) {
+            assertNotNull(tfv);
+            assertTrue(tfv instanceof TermPositionVector);
+            final TermPositionVector tpv = (TermPositionVector) tfv;
+            final BytesRef[] terms = tpv.getTerms();
+            assertEquals(2, terms.length);
+            assertEquals(new BytesRef(""+counter), terms[0]);
+            assertEquals(new BytesRef("text"), terms[1]);
+
+            final int[] freqs = tpv.getTermFrequencies();
+            assertEquals(2, freqs.length);
+            assertEquals(1, freqs[0]);
+            assertEquals(1, freqs[1]);
+
+            int[] positions = tpv.getTermPositions(0);
+            assertEquals(1, positions.length);
+            assertEquals(1, positions[0]);
+
+            positions = tpv.getTermPositions(1);
+            assertEquals(1, positions.length);
+            assertEquals(0, positions[0]);
+
+            // TODO: offsets
+            
+          } else {
+            assertNull(tfv);
+          }
+
+          if (numeric) {
+            NumericRangeQuery nrq = NumericRangeQuery.newIntRange(name, counter, counter, true, true);
+            final TopDocs hits2 = s.search(nrq, 1);
+            assertEquals(1, hits2.totalHits);
+            assertEquals(docID, hits2.scoreDocs[0].doc);
+          } else {
+            BooleanQuery bq = new BooleanQuery();
+            bq.add(new TermQuery(new Term("id", ""+id)), BooleanClause.Occur.MUST);
+            bq.add(new TermQuery(new Term(name, "text")), BooleanClause.Occur.MUST);
+            final TopDocs hits2 = s.search(bq, 1);
+            assertEquals(1, hits2.totalHits);
+            assertEquals(docID, hits2.scoreDocs[0].doc);
+
+            bq = new BooleanQuery();
+            bq.add(new TermQuery(new Term("id", ""+id)), BooleanClause.Occur.MUST);
+            bq.add(new TermQuery(new Term(name, ""+counter)), BooleanClause.Occur.MUST);
+            final TopDocs hits3 = s.search(bq, 1);
+            assertEquals(1, hits3.totalHits);
+            assertEquals(docID, hits3.scoreDocs[0].doc);
+          }
+        }
+
+        counter++;
+      }
+    }
+
+    r.close();
+    dir.close();
+  }
+}
\ No newline at end of file

Modified: lucene/dev/branches/fieldtype_conflicted/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/solr/core/src/java/org/apache/solr/handler/admin/LukeRequestHandler.java Sun Aug 21 15:24:10 2011
@@ -177,7 +177,7 @@ public class LukeRequestHandler extends 
     flags.append( (f != null && f.storeTermVectorOffsets())   ? FieldFlag.TERM_VECTOR_OFFSET.getAbbreviation() : '-' );
     flags.append( (f != null && f.storeTermVectorPositions()) ? FieldFlag.TERM_VECTOR_POSITION.getAbbreviation() : '-' );
     flags.append( (f != null && f.omitNorms())                  ? FieldFlag.OMIT_NORMS.getAbbreviation() : '-' );
-    flags.append( (f != null && ((Field) f).lazy())                        ? FieldFlag.LAZY.getAbbreviation() : '-' );
+    flags.append( (f != null && f.getClass().getSimpleName().equals("LazyField")) ? FieldFlag.LAZY.getAbbreviation() : '-' );
     flags.append( (f != null && f.binaryValue(null)!=null)                      ? FieldFlag.BINARY.getAbbreviation() : '-' );
     flags.append( (false)                                          ? FieldFlag.SORT_MISSING_FIRST.getAbbreviation() : '-' ); // SchemaField Specific
     flags.append( (false)                                          ? FieldFlag.SORT_MISSING_LAST.getAbbreviation() : '-' ); // SchemaField Specific

Modified: lucene/dev/branches/fieldtype_conflicted/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/fieldtype_conflicted/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java?rev=1159996&r1=1159995&r2=1159996&view=diff
==============================================================================
--- lucene/dev/branches/fieldtype_conflicted/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java (original)
+++ lucene/dev/branches/fieldtype_conflicted/solr/core/src/test/org/apache/solr/BasicFunctionalityTest.java Sun Aug 21 15:24:10 2011
@@ -563,8 +563,8 @@ public class BasicFunctionalityTest exte
     DocList dl = ((ResultContext) rsp.getValues().get("response")).docs;
     Document d = req.getSearcher().doc(dl.iterator().nextDoc());
     // ensure field is not lazy, only works for Non-Numeric fields currently (if you change schema behind test, this may fail)
-    assertFalse( ((Field) d.getField("test_hlt")).lazy() );
-    assertFalse( ((Field) d.getField("title")).lazy() );
+    assertFalse( ((Field) d.getField("test_hlt")).getClass().getSimpleName().equals("LazyField"));
+    assertFalse( ((Field) d.getField("title")).getClass().getSimpleName().equals("LazyField"));
     req.close();
   }
 
@@ -587,8 +587,8 @@ public class BasicFunctionalityTest exte
     Document d = req.getSearcher().doc(di.nextDoc());
     // ensure field is lazy
     System.out.println(d.getField("test_hlt").getClass());
-    assertTrue( ((Field) d.getField("test_hlt")).lazy() );
-    assertFalse( ((Field) d.getField("title")).lazy() );
+    assertTrue( ((Field) d.getField("test_hlt")).getClass().getSimpleName().equals("LazyField"));
+    assertFalse( ((Field) d.getField("title")).getClass().getSimpleName().equals("LazyField"));
     req.close();
   }