diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextCodec.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextCodec.java index a412b6e74b6..531f38458e4 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextCodec.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextCodec.java @@ -24,6 +24,7 @@ import org.apache.lucene.codecs.LiveDocsFormat; import org.apache.lucene.codecs.NormsFormat; import org.apache.lucene.codecs.PostingsFormat; import org.apache.lucene.codecs.SegmentInfoFormat; +import org.apache.lucene.codecs.SimpleDocValuesFormat; import org.apache.lucene.codecs.StoredFieldsFormat; import org.apache.lucene.codecs.TermVectorsFormat; @@ -88,4 +89,13 @@ public final class SimpleTextCodec extends Codec { public LiveDocsFormat liveDocsFormat() { return liveDocs; } + + // nocommit; + private final SimpleDocValuesFormat nocommit = new SimpleTextSimpleDocValuesFormat(); + @Override + public SimpleDocValuesFormat simpleDocValuesFormat() { + return nocommit; + } + + } diff --git a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java index a8832394a62..d2a3ec95c8b 100644 --- a/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java +++ b/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java @@ -369,6 +369,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat { readLine(); assert startsWith(PATTERN); field.pattern = stripPrefix(PATTERN); + field.dataStartFilePointer = data.getFilePointer(); data.seek(data.getFilePointer() + (1+field.pattern.length()) * maxDoc); } else if (DocValues.isBytes(dvType)) { readLine(); @@ -377,6 +378,7 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat { readLine(); assert startsWith(PATTERN); field.pattern = stripPrefix(PATTERN); + field.dataStartFilePointer = data.getFilePointer(); data.seek(data.getFilePointer() + (9+field.pattern.length()+field.maxLength) * maxDoc); break; } else if (DocValues.isSortedBytes(dvType)) { @@ -392,12 +394,13 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat { readLine(); assert startsWith(ORDPATTERN); field.ordPattern = stripPrefix(ORDPATTERN); + field.dataStartFilePointer = data.getFilePointer(); + // nocommit: we need to seek past the data section!!!! } else if (DocValues.isFloat(dvType)) { // nocommit } else { throw new AssertionError(); } - field.dataStartFilePointer = data.getFilePointer(); } } @@ -515,7 +518,15 @@ public class SimpleTextSimpleDocValuesFormat extends SimpleDocValuesFormat { // value from the wrong field ... in.seek(field.dataStartFilePointer + (1+field.pattern.length())*docID); SimpleTextUtil.readLine(in, scratch); - return decoder.parse(scratch.utf8ToString(), pos).longValue(); + System.out.println("trying to parse number: " + scratch.utf8ToString()); + // nocommit + long seekPos = field.dataStartFilePointer; + byte wholeFile[] = new byte[(int)(in.length()-seekPos)]; + IndexInput foo = in.clone(); + foo.seek(seekPos); + foo.readBytes(wholeFile, 0, wholeFile.length); + System.out.println("rest: " + new String(wholeFile, 0, wholeFile.length, "UTF-8")); + return field.minValue + decoder.parse(scratch.utf8ToString(), pos).longValue(); } catch (IOException ioe) { throw new RuntimeException(ioe); } diff --git a/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java b/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java index 62885d2d395..3020fb87278 100644 --- a/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java +++ b/lucene/core/src/java/org/apache/lucene/index/DocFieldProcessor.java @@ -147,7 +147,8 @@ final class DocFieldProcessor extends DocConsumer { } // close perDocConsumer during flush to ensure all files are flushed due to PerCodec CFS - IOUtils.close(perDocConsumer); + // nocommit + IOUtils.close(perDocConsumer, dvConsumer); // Important to save after asking consumer to flush so // consumer can alter the FieldInfo* if necessary. EG, diff --git a/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java b/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java index 92a33d2c17a..cc322313f3e 100644 --- a/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java +++ b/lucene/core/src/java/org/apache/lucene/index/SegmentCoreReaders.java @@ -110,7 +110,8 @@ final class SegmentCoreReaders { // TODO: since we don't write any norms file if there are no norms, // kinda jaky to assume the codec handles the case of no norms file at all gracefully?! norms = codec.normsFormat().docsProducer(segmentReadState); - perDocProducer = codec.docValuesFormat().docsProducer(segmentReadState); + // nocommit + perDocProducer = codec.simpleDocValuesFormat().fieldsProducer(segmentReadState); fieldsReaderOrig = si.info.getCodec().storedFieldsFormat().fieldsReader(cfsDir, si.info, fieldInfos, context);