lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1210300 - in /lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index: ./ codecs/ codecs/lucene40/
Date Mon, 05 Dec 2011 00:56:02 GMT
Author: rmuir
Date: Mon Dec  5 00:56:01 2011
New Revision: 1210300

URL: http://svn.apache.org/viewvc?rev=1210300&view=rev
Log:
LUCENE-3606: remove .nrm from IndexFileNames

Modified:
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexFileNames.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsFormat.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsReader.java
    lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsWriter.java

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexFileNames.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexFileNames.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexFileNames.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/IndexFileNames.java
Mon Dec  5 00:56:01 2011
@@ -49,9 +49,6 @@ public final class IndexFileNames {
   
   /** Name of the generation reference file name */
   public static final String SEGMENTS_GEN = "segments." +  GEN_EXTENSION;
-  
-  /** Extension of norms file */
-  public static final String NORMS_EXTENSION = "nrm";
 
   /** Extension of compound file */
   public static final String COMPOUND_FILE_EXTENSION = "cfs";
@@ -80,14 +77,9 @@ public final class IndexFileNames {
     COMPOUND_FILE_ENTRIES_EXTENSION,
     DELETES_EXTENSION,
     GEN_EXTENSION,
-    NORMS_EXTENSION,
     COMPOUND_FILE_STORE_EXTENSION,
   };
 
-  public static final String[] NON_STORE_INDEX_EXTENSIONS = new String[] {
-    NORMS_EXTENSION
-  };
-
   /**
    * Computes the full file name from base, extension and generation. If the
    * generation is -1, the file name is null. If it's 0, the file name is

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentInfo.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/SegmentInfo.java
Mon Dec  5 00:56:01 2011
@@ -466,11 +466,6 @@ public final class SegmentInfo implement
     return codec;
   }
 
-  private void addIfExists(Set<String> files, String fileName) throws IOException {
-    if (dir.fileExists(fileName))
-      files.add(fileName);
-  }
-
   /*
    * Return all files referenced by this SegmentInfo.  The
    * returns List is a locally cached List so you should not
@@ -496,9 +491,6 @@ public final class SegmentInfo implement
             IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
       }
     } else {
-      for(String ext : IndexFileNames.NON_STORE_INDEX_EXTENSIONS) {
-        addIfExists(fileSet, IndexFileNames.segmentFileName(name, "", ext));
-      }
       codec.files(dir, this, fileSet);
     }
 
@@ -517,6 +509,7 @@ public final class SegmentInfo implement
       fileSet.add(delFileName);
     }
    
+    // TODO: push this to codec?
     if (normGen != null) {
       for (Entry<Integer,Long> entry : normGen.entrySet()) {
         long gen = entry.getValue();

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/Codec.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/Codec.java
Mon Dec  5 00:56:01 2011
@@ -51,8 +51,7 @@ public abstract class Codec implements N
     // TODO: segmentInfosFormat should be allowed to declare additional files
     // if it wants, in addition to segments_N
     docValuesFormat().files(dir, info, files);
-    // nocommit: not yet
-    //normsFormat().files(dir, info, files);
+    normsFormat().files(dir, info, files);
   }
   
   /** Encodes/decodes postings */

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsFormat.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsFormat.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsFormat.java
Mon Dec  5 00:56:01 2011
@@ -43,7 +43,6 @@ public class Lucene40NormsFormat extends
 
   @Override
   public void files(Directory dir, SegmentInfo info, Set<String> files) throws IOException
{
-    // nocommit: hairy calculations involving .s files, etc
+    Lucene40NormsReader.files(dir, info, files);
   }
-  
 }

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsReader.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsReader.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsReader.java
Mon Dec  5 00:56:01 2011
@@ -21,6 +21,7 @@ import java.io.IOException;
 import java.util.HashMap;
 import java.util.IdentityHashMap;
 import java.util.Map;
+import java.util.Set;
 
 import org.apache.lucene.index.FieldInfo;
 import org.apache.lucene.index.FieldInfos;
@@ -59,7 +60,7 @@ public class Lucene40NormsReader extends
           Directory d = hasSeparateNorms(normGen, fi.number) ? separateNormsDir : dir;
         
           // singleNormFile means multiple norms share this file
-          boolean singleNormFile = IndexFileNames.matchesExtension(fileName, IndexFileNames.NORMS_EXTENSION);
+          boolean singleNormFile = IndexFileNames.matchesExtension(fileName, Lucene40NormsWriter.NORMS_EXTENSION);
           IndexInput normInput = null;
           long normSeek;
 
@@ -134,7 +135,7 @@ public class Lucene40NormsReader extends
       return IndexFileNames.fileNameFromGeneration(segmentName, IndexFileNames.SEPARATE_NORMS_EXTENSION
+ number, normGen.get(number));
     } else {
       // single file for all norms
-      return IndexFileNames.fileNameFromGeneration(segmentName, IndexFileNames.NORMS_EXTENSION,
SegmentInfo.WITHOUT_GEN);
+      return IndexFileNames.fileNameFromGeneration(segmentName, Lucene40NormsWriter.NORMS_EXTENSION,
SegmentInfo.WITHOUT_GEN);
     }
   }
   
@@ -170,4 +171,13 @@ public class Lucene40NormsReader extends
       return bytes;
     }
   }
+  
+  static void files(Directory dir, SegmentInfo info, Set<String> files) throws IOException
{
+    // TODO: This is what SI always did... but we can do this cleaner?
+    // like first FI that has norms but doesn't have separate norms?
+    final String normsFileName = IndexFileNames.segmentFileName(info.name, "", Lucene40NormsWriter.NORMS_EXTENSION);
+    if (dir.fileExists(normsFileName)) {
+      files.add(normsFileName);
+    }
+  }
 }

Modified: lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsWriter.java?rev=1210300&r1=1210299&r2=1210300&view=diff
==============================================================================
--- lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsWriter.java
(original)
+++ lucene/dev/branches/lucene3606/lucene/src/java/org/apache/lucene/index/codecs/lucene40/Lucene40NormsWriter.java
Mon Dec  5 00:56:01 2011
@@ -35,11 +35,13 @@ public class Lucene40NormsWriter extends
   private int normCount = 0;
   
   /** norms header placeholder */
-  // nocommit: not public
-  public static final byte[] NORMS_HEADER = new byte[]{'N','R','M',-1};
+  static final byte[] NORMS_HEADER = new byte[]{'N','R','M',-1};
+  
+  /** Extension of norms file */
+  static final String NORMS_EXTENSION = "nrm";
   
   public Lucene40NormsWriter(Directory directory, String segment, IOContext context) throws
IOException {
-    final String normsFileName = IndexFileNames.segmentFileName(segment, "", IndexFileNames.NORMS_EXTENSION);
+    final String normsFileName = IndexFileNames.segmentFileName(segment, "", NORMS_EXTENSION);
     boolean success = false;
     try {
       out = directory.createOutput(normsFileName, context);



Mime
View raw message