lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From h..@apache.org
Subject svn commit: r1508817 - in /lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp: TempFSTOrdTermsReader.java TempFSTOrdTermsWriter.java
Date Wed, 31 Jul 2013 11:42:36 GMT
Author: han
Date: Wed Jul 31 11:42:36 2013
New Revision: 1508817

URL: http://svn.apache.org/r1508817
Log:
clean up codes

Modified:
    lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsReader.java
    lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsWriter.java

Modified: lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsReader.java?rev=1508817&r1=1508816&r2=1508817&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsReader.java
(original)
+++ lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsReader.java
Wed Jul 31 11:42:36 2013
@@ -297,6 +297,9 @@ public class TempFSTOrdTermsReader exten
         this.totalTermFreq = new long[INTERVAL];
         this.statsBlockOrd = -1;
         this.metaBlockOrd = -1;
+        if (!hasFreqs()) {
+          Arrays.fill(totalTermFreq, -1);
+        }
       }
 
       /** Decodes stats data into term state */
@@ -328,9 +331,6 @@ public class TempFSTOrdTermsReader exten
         final int offset = statsBlockOrd * numSkipInfo;
         final int statsFP = (int)skipInfo[offset];
         statsReader.setPosition(statsFP);
-        if (!hasFreqs()) {
-          Arrays.fill(totalTermFreq, -1);
-        }
         for (int i = 0; i < INTERVAL && !statsReader.eof(); i++) {
           int code = statsReader.readVInt();
           if (hasFreqs()) {
@@ -352,16 +352,16 @@ public class TempFSTOrdTermsReader exten
         final int metaLongsFP = (int)skipInfo[offset + 1];
         final int metaBytesFP = (int)skipInfo[offset + 2];
         metaLongsReader.setPosition(metaLongsFP);
-        bytesStart[0] = metaBytesFP; 
         for (int j = 0; j < longsSize; j++) {
           longs[0][j] = skipInfo[offset + 3 + j] + metaLongsReader.readVLong();
         }
+        bytesStart[0] = metaBytesFP; 
         bytesLength[0] = (int)metaLongsReader.readVLong();
         for (int i = 1; i < INTERVAL && !metaLongsReader.eof(); i++) {
-          bytesStart[i] = bytesStart[i-1] + bytesLength[i-1];
           for (int j = 0; j < longsSize; j++) {
             longs[i][j] = longs[i-1][j] + metaLongsReader.readVLong();
           }
+          bytesStart[i] = bytesStart[i-1] + bytesLength[i-1];
           bytesLength[i] = (int)metaLongsReader.readVLong();
         }
       }
@@ -418,10 +418,8 @@ public class TempFSTOrdTermsReader exten
       public long ord() {
         throw new UnsupportedOperationException();
       }
-
     }
 
-
     // Iterates through all terms in this field
     private final class SegmentTermsEnum extends BaseTermsEnum {
       final BytesRefFSTEnum<Long> fstEnum;
@@ -584,11 +582,8 @@ public class TempFSTOrdTermsReader exten
       @Override
       void decodeStats() throws IOException {
         final FST.Arc<Long> arc = topFrame().arc;
-        if (arc.isFinal()) {
-          ord = fstOutputs.add(arc.output, arc.nextFinalOutput);
-        } else {
-          ord = arc.output;
-        }
+        assert arc.nextFinalOutput == fstOutputs.getNoOutput();
+        ord = arc.output;
         super.decodeStats();
       }
 
@@ -663,7 +658,7 @@ public class TempFSTOrdTermsReader exten
           pushFrame(frame);
           return isAccept(frame) ? term : next();
         }
-        while (level > 0) {  // got target's prefix, advance to larger term
+        while (level > 0) {   // got target's prefix, advance to larger term
           frame = popFrame();
           while (level > 0 && !canRewind(frame)) {
             frame = popFrame();
@@ -761,12 +756,12 @@ public class TempFSTOrdTermsReader exten
         arc.output = fstOutputs.add(topFrame().arc.output, arc.output);
         term = grow(arc.label);
         level++;
+        assert frame == stack[level];
       }
 
       Frame popFrame() {
         term = shrink();
-        level--;
-        return stack[level+1];
+        return stack[level--];
       }
 
       Frame newFrame() {

Modified: lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsWriter.java?rev=1508817&r1=1508816&r2=1508817&view=diff
==============================================================================
--- lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsWriter.java
(original)
+++ lucene/dev/branches/lucene3069/lucene/core/src/java/org/apache/lucene/codecs/temp/TempFSTOrdTermsWriter.java
Wed Jul 31 11:42:36 2013
@@ -54,7 +54,7 @@ public class TempFSTOrdTermsWriter exten
   public static final int TERMS_VERSION_START = 0;
   public static final int TERMS_VERSION_CURRENT = TERMS_VERSION_START;
   public static final int SKIP_INTERVAL = 8;
-  static final boolean TEST = false;
+  //static final boolean TEST = false;
   
   final TempPostingsWriterBase postingsWriter;
   final FieldInfos fieldInfos;
@@ -229,7 +229,6 @@ public class TempFSTOrdTermsWriter exten
 
       lastMetaBytesFP = metaBytesOut.getFilePointer();
       lastLongs = longs;
-
     }
 
     @Override



Mime
View raw message