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 2013/07/25 22:25:09 UTC

svn commit: r1507111 - in /lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms: FixedGapTermsIndexReader.java FixedGapTermsIndexWriter.java

Author: rmuir
Date: Thu Jul 25 20:25:09 2013
New Revision: 1507111

URL: http://svn.apache.org/r1507111
Log:
LUCENE-5127: clear nocommits

Modified:
    lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java
    lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexWriter.java

Modified: lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java?rev=1507111&r1=1507110&r2=1507111&view=diff
==============================================================================
--- lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java (original)
+++ lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexReader.java Thu Jul 25 20:25:09 2013
@@ -28,7 +28,6 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.PagedBytes;
 import org.apache.lucene.util.packed.MonotonicBlockPackedReader;
-import org.apache.lucene.util.packed.PackedInts;
 
 import java.util.HashMap;
 import java.util.Comparator;
@@ -50,6 +49,9 @@ public class FixedGapTermsIndexReader ex
   // having to upgrade each multiple to long in multiple
   // places (error prone), we use long here:
   private final long indexInterval;
+  
+  private final int packedIntsVersion;
+  private final int blocksize;
 
   private final Comparator<BytesRef> termComp;
 
@@ -76,10 +78,12 @@ public class FixedGapTermsIndexReader ex
     try {
       
       readHeader(in);
-      indexInterval = in.readInt();
+      indexInterval = in.readVInt();
       if (indexInterval < 1) {
         throw new CorruptIndexException("invalid indexInterval: " + indexInterval + " (resource=" + in + ")");
       }
+      packedIntsVersion = in.readVInt();
+      blocksize = in.readVInt();
       
       seekDir(in, dirOffset);
 
@@ -244,12 +248,10 @@ public class FixedGapTermsIndexReader ex
         termBytes.copy(clone, numTermBytes);
         
         // records offsets into main terms dict file
-        // nocommit: actually write these params
-        termsDictOffsets = new MonotonicBlockPackedReader(clone, PackedInts.VERSION_CURRENT, FixedGapTermsIndexWriter.BLOCKSIZE, numIndexTerms, false);
+        termsDictOffsets = new MonotonicBlockPackedReader(clone, packedIntsVersion, blocksize, numIndexTerms, false);
         
         // records offsets into byte[] term data
-        // nocommit: actually write these params
-        termOffsets = new MonotonicBlockPackedReader(clone, PackedInts.VERSION_CURRENT, FixedGapTermsIndexWriter.BLOCKSIZE, 1+numIndexTerms, false);
+        termOffsets = new MonotonicBlockPackedReader(clone, packedIntsVersion, blocksize, 1+numIndexTerms, false);
       } finally {
         clone.close();
       }
@@ -258,13 +260,7 @@ public class FixedGapTermsIndexReader ex
 
   @Override
   public FieldIndexEnum getFieldEnum(FieldInfo fieldInfo) {
-    final FieldIndexData fieldData = fields.get(fieldInfo);
-    // nocommit: can fieldData ever be null?
-    if (fieldData == null) {
-      return null;
-    } else {
-      return new IndexEnum(fieldData);
-    }
+    return new IndexEnum(fields.get(fieldInfo));
   }
 
   @Override

Modified: lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexWriter.java?rev=1507111&r1=1507110&r2=1507111&view=diff
==============================================================================
--- lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexWriter.java (original)
+++ lucene/dev/branches/lucene5127/lucene/codecs/src/java/org/apache/lucene/codecs/blockterms/FixedGapTermsIndexWriter.java Thu Jul 25 20:25:09 2013
@@ -27,6 +27,7 @@ import org.apache.lucene.util.BytesRef;
 import org.apache.lucene.util.ArrayUtil;
 import org.apache.lucene.util.IOUtils;
 import org.apache.lucene.util.packed.MonotonicBlockPackedWriter;
+import org.apache.lucene.util.packed.PackedInts;
 
 import java.util.List;
 import java.util.ArrayList;
@@ -72,7 +73,9 @@ public class FixedGapTermsIndexWriter ex
     boolean success = false;
     try {
       writeHeader(out);
-      out.writeInt(termIndexInterval);
+      out.writeVInt(termIndexInterval);
+      out.writeVInt(PackedInts.VERSION_CURRENT);
+      out.writeVInt(BLOCKSIZE);
       success = true;
     } finally {
       if (!success) {