lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bmes...@apache.org
Subject svn commit: r189794 - in /lucene/java/trunk/src/java/org/apache/lucene/index: IndexReader.java IndexWriter.java SegmentInfos.java SegmentMerger.java SegmentReader.java
Date Thu, 09 Jun 2005 19:00:37 GMT
Author: bmesser
Date: Thu Jun  9 12:00:36 2005
New Revision: 189794

URL: http://svn.apache.org/viewcvs?rev=189794&view=rev
Log:
use filenames and extensions from org.apache.lucene.index.IndexFileNames

Modified:
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java
    lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
    lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java?rev=189794&r1=189793&r2=189794&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexReader.java Thu Jun  9 12:00:36
2005
@@ -54,16 +54,6 @@
 */
 public abstract class IndexReader {
   
-  /**
-   * This array contains all filename extensions used by Lucene's index files, with
-   * one exception, namely the extension made up from <code>.f</code> + a number.
-   * Also note that two of Lucene's files (<code>deletable</code> and
-   * <code>segments</code>) don't have any filename extension.
-   */
-  public final static String FILENAME_EXTENSIONS[] = new String[] {
-      "cfs", "fnm", "fdx", "fdt", "tii", "tis", "frq", "prx", "del",
-      "tvx", "tvd", "tvf", "tvp" };
-  
   public static final class FieldOption {
     private String option;
     private FieldOption() { }
@@ -188,7 +178,7 @@
    * {@link #isCurrent()} instead. 
    */
   public static long lastModified(File directory) throws IOException {
-    return FSDirectory.fileModified(directory, Constants.INDEX_SEGMENTS_FILENAME);
+    return FSDirectory.fileModified(directory, IndexFileNames.SEGMENTS);
   }
 
   /** 
@@ -197,7 +187,7 @@
    * {@link #isCurrent()} instead. 
    */
   public static long lastModified(Directory directory) throws IOException {
-    return directory.fileModified(Constants.INDEX_SEGMENTS_FILENAME);
+    return directory.fileModified(IndexFileNames.SEGMENTS);
   }
 
   /**
@@ -306,7 +296,7 @@
    * @return <code>true</code> if an index exists; <code>false</code>
otherwise
    */
   public static boolean indexExists(String directory) {
-    return (new File(directory, Constants.INDEX_SEGMENTS_FILENAME)).exists();
+    return (new File(directory, IndexFileNames.SEGMENTS)).exists();
   }
 
   /**
@@ -316,7 +306,7 @@
    * @return <code>true</code> if an index exists; <code>false</code>
otherwise
    */
   public static boolean indexExists(File directory) {
-    return (new File(directory, Constants.INDEX_SEGMENTS_FILENAME)).exists();
+    return (new File(directory, IndexFileNames.SEGMENTS)).exists();
   }
 
   /**
@@ -327,7 +317,7 @@
    * @throws IOException if there is a problem with accessing the index
    */
   public static boolean indexExists(Directory directory) throws IOException {
-    return directory.fileExists(Constants.INDEX_SEGMENTS_FILENAME);
+    return directory.fileExists(IndexFileNames.SEGMENTS);
   }
 
   /** Returns the number of documents in this index. */

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java?rev=189794&r1=189793&r2=189794&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/IndexWriter.java Thu Jun  9 12:00:36
2005
@@ -792,10 +792,10 @@
 
   private final Vector readDeleteableFiles() throws IOException {
     Vector result = new Vector();
-    if (!directory.fileExists(Constants.INDEX_DELETABLE_FILENAME))
+    if (!directory.fileExists(IndexFileNames.DELETABLE))
       return result;
 
-    IndexInput input = directory.openInput(Constants.INDEX_DELETABLE_FILENAME);
+    IndexInput input = directory.openInput(IndexFileNames.DELETABLE);
     try {
       for (int i = input.readInt(); i > 0; i--)	  // read file names
         result.addElement(input.readString());
@@ -814,6 +814,6 @@
     } finally {
       output.close();
     }
-    directory.renameFile("deleteable.new", Constants.INDEX_DELETABLE_FILENAME);
+    directory.renameFile("deleteable.new", IndexFileNames.DELETABLE);
   }
 }

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java?rev=189794&r1=189793&r2=189794&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentInfos.java Thu Jun  9 12:00:36
2005
@@ -42,7 +42,7 @@
 
   public final void read(Directory directory) throws IOException {
     
-    IndexInput input = directory.openInput(Constants.INDEX_SEGMENTS_FILENAME);
+    IndexInput input = directory.openInput(IndexFileNames.SEGMENTS);
     try {
       int format = input.readInt();
       if(format < 0){     // file contains explicit format info
@@ -92,7 +92,7 @@
     }
 
     // install new segment info
-    directory.renameFile("segments.new", Constants.INDEX_SEGMENTS_FILENAME);
+    directory.renameFile("segments.new", IndexFileNames.SEGMENTS);
   }
 
   /**
@@ -108,7 +108,7 @@
   public static long readCurrentVersion(Directory directory)
     throws IOException {
       
-    IndexInput input = directory.openInput(Constants.INDEX_SEGMENTS_FILENAME);
+    IndexInput input = directory.openInput(IndexFileNames.SEGMENTS);
     int format = 0;
     long version = 0;
     try {

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java?rev=189794&r1=189793&r2=189794&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentMerger.java Thu Jun  9 12:00:36
2005
@@ -43,14 +43,6 @@
   private Vector readers = new Vector();
   private FieldInfos fieldInfos;
 
-  // File extensions of old-style index files
-  private static final String COMPOUND_EXTENSIONS[] = new String[] {
-    "fnm", "frq", "prx", "fdx", "fdt", "tii", "tis"
-  };
-  private static final String VECTOR_EXTENSIONS[] = new String[] {
-    "tvx", "tvd", "tvf"
-  };
-
   /** This ctor used only by test code.
    * 
    * @param dir The Directory to merge the other segments into
@@ -120,11 +112,11 @@
             new CompoundFileWriter(directory, fileName);
 
     Vector files =
-      new Vector(COMPOUND_EXTENSIONS.length + fieldInfos.size());    
+      new Vector(IndexFileNames.COMPOUND_EXTENSIONS.length + fieldInfos.size());    
     
     // Basic files
-    for (int i = 0; i < COMPOUND_EXTENSIONS.length; i++) {
-      files.add(segment + "." + COMPOUND_EXTENSIONS[i]);
+    for (int i = 0; i < IndexFileNames.COMPOUND_EXTENSIONS.length; i++) {
+      files.add(segment + "." + IndexFileNames.COMPOUND_EXTENSIONS[i]);
     }
 
     // Field norm files
@@ -137,8 +129,8 @@
 
     // Vector files
     if (fieldInfos.hasVectors()) {
-      for (int i = 0; i < VECTOR_EXTENSIONS.length; i++) {
-        files.add(segment + "." + VECTOR_EXTENSIONS[i]);
+      for (int i = 0; i < IndexFileNames.VECTOR_EXTENSIONS.length; i++) {
+        files.add(segment + "." + IndexFileNames.VECTOR_EXTENSIONS[i]);
       }
     }
 

Modified: lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java
URL: http://svn.apache.org/viewcvs/lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java?rev=189794&r1=189793&r2=189794&view=diff
==============================================================================
--- lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java (original)
+++ lucene/java/trunk/src/java/org/apache/lucene/index/SegmentReader.java Thu Jun  9 12:00:36
2005
@@ -248,8 +248,8 @@
   Vector files() throws IOException {
     Vector files = new Vector(16);
 
-    for (int i = 0; i < FILENAME_EXTENSIONS.length; i++) {
-      String name = segment + "." + FILENAME_EXTENSIONS[i];
+    for (int i = 0; i < IndexFileNames.INDEX_EXTENSIONS.length; i++) {
+      String name = segment + "." + IndexFileNames.INDEX_EXTENSIONS[i];
       if (directory().fileExists(name))
         files.addElement(name);
     }



Mime
View raw message