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 2012/11/09 18:47:59 UTC

svn commit: r1407559 - /lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java

Author: rmuir
Date: Fri Nov  9 17:47:58 2012
New Revision: 1407559

URL: http://svn.apache.org/viewvc?rev=1407559&view=rev
Log:
file format for simpletext bytes

Modified:
    lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java

Modified: lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java?rev=1407559&r1=1407558&r2=1407559&view=diff
==============================================================================
--- lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java (original)
+++ lucene/dev/branches/lucene4547/lucene/codecs/src/java/org/apache/lucene/codecs/simpletext/SimpleTextSimpleDocValuesFormat.java Fri Nov  9 17:47:58 2012
@@ -50,6 +50,9 @@ public class SimpleTextSimpleDocValuesFo
   // used for numerics
   final static BytesRef MINVALUE = new BytesRef("  minvalue ");
   final static BytesRef PATTERN  = new BytesRef("  pattern ");
+  // used for bytes
+  final static BytesRef MAXLENGTH = new BytesRef("  maxlength ");
+  final static BytesRef LENGTH = new BytesRef("length ");
 
   @Override
   public SimpleDVConsumer fieldsConsumer(SegmentWriteState state) throws IOException {
@@ -69,6 +72,20 @@ public class SimpleTextSimpleDocValuesFo
    *  </pre>
    *  so a document's value (delta encoded from minvalue) can be retrieved by 
    *  seeking to startOffset + (1+pattern.length())*docid. The extra 1 is the newline.
+   *  
+   *  for bytes this is also a "fixed-width" file, for example:
+   *  <pre>
+   *  field myField
+   *    pattern 0
+   *    maxlength 8
+   *  length 6
+   *  foobar[space][space]
+   *  length 3
+   *  baz[space][space][space][space][space]
+   *  ...
+   *  </pre>
+   *  so a document's value can be retrieved by seeking to startOffset + (9+2*pattern.length)*docid
+   *  the extra 9 is 2 newlines, plus "length " itself.
    *   
    *  the reader can just scan this file when it opens, skipping over the data blocks
    *  and saving the offset/etc for each field.