lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1227845 - /lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java
Date Thu, 05 Jan 2012 21:21:54 GMT
Author: rmuir
Date: Thu Jan  5 21:21:54 2012
New Revision: 1227845

URL: http://svn.apache.org/viewvc?rev=1227845&view=rev
Log:
LUCENE-3678: fix TestAddIndexes fail

Modified:
    lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java

Modified: lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java?rev=1227845&r1=1227844&r2=1227845&view=diff
==============================================================================
--- lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java
(original)
+++ lucene/dev/trunk/lucene/src/java/org/apache/lucene/codecs/lucene40/Lucene40NormsFormat.java
Thu Jan  5 21:21:54 2012
@@ -111,21 +111,16 @@ public class Lucene40NormsFormat extends
     }
     
     public static void files(Directory dir, SegmentInfo segmentInfo, Set<String> files)
throws IOException {
-      FieldInfos fieldInfos = segmentInfo.getFieldInfos();
-      for (FieldInfo fieldInfo : fieldInfos) {
-        if (!fieldInfo.omitNorms && fieldInfo.isIndexed) {
-          files.add(IndexFileNames.segmentFileName(segmentInfo.name, NORMS_SEGMENT_SUFFIX,
IndexFileNames.COMPOUND_FILE_EXTENSION));
-          files.add(IndexFileNames.segmentFileName(segmentInfo.name, NORMS_SEGMENT_SUFFIX,
IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION));
-          assert dir.fileExists(IndexFileNames.segmentFileName(segmentInfo.name, NORMS_SEGMENT_SUFFIX,
IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION)); 
-          assert dir.fileExists(IndexFileNames.segmentFileName(segmentInfo.name, NORMS_SEGMENT_SUFFIX,
IndexFileNames.COMPOUND_FILE_EXTENSION)); 
-          break;
-        }
+      // see the comment in all the other codecs... its bogus that we do fileExists here,
but its 
+      // a harder problem since fieldinfos are never 'cleaned'
+      final String normsFileName = IndexFileNames.segmentFileName(segmentInfo.name, NORMS_SEGMENT_SUFFIX,
IndexFileNames.COMPOUND_FILE_EXTENSION);
+      if (dir.fileExists(normsFileName)) {
+        final String normsEntriesFileName = IndexFileNames.segmentFileName(segmentInfo.name,
NORMS_SEGMENT_SUFFIX, IndexFileNames.COMPOUND_FILE_ENTRIES_EXTENSION);
+        assert dir.fileExists(normsEntriesFileName);
+        files.add(normsFileName);
+        files.add(normsEntriesFileName);
       }
     }
-    
   }
-  
- 
-
 
 }



Mime
View raw message