[jsword-svn] r1254 - in trunk/jsword: . src/main/java/org/crosswire/jsword/index/lucene

dmsmith at www.crosswire.org dmsmith at www.crosswire.org
Mon Mar 19 15:07:44 MST 2007


Author: dmsmith
Date: 2007-03-19 15:07:43 -0700 (Mon, 19 Mar 2007)
New Revision: 1254

Modified:
   trunk/jsword/.classpath
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
   trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java
Log:
Fixed a bug introduced by the new lucene file format.

Modified: trunk/jsword/.classpath
===================================================================
--- trunk/jsword/.classpath	2007-03-16 21:16:26 UTC (rev 1253)
+++ trunk/jsword/.classpath	2007-03-19 22:07:43 UTC (rev 1254)
@@ -4,6 +4,6 @@
 	<classpathentry exported="true" kind="src" path="/common"/>
 	<classpathentry kind="src" path="src/main/java"/>
 	<classpathentry kind="src" path="src/test/java"/>
-	<classpathentry exported="true" kind="lib" path="jar/lucene-2.1.0/lucene-core-2.1.0.jar"/>
+	<classpathentry exported="true" kind="lib" path="jar/lucene-2.1.0/lucene-core-2.1.0.jar" sourcepath="jar/lucene-2.1.0/lucene-2.1.0-src.zip"/>
 	<classpathentry kind="output" path="bin"/>
 </classpath>

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2007-03-16 21:16:26 UTC (rev 1253)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndex.java	2007-03-19 22:07:43 UTC (rev 1254)
@@ -140,14 +140,16 @@
                 job.setWork(95);
 
                 // Consolidate the index into the minimum number of files.
-                writer.optimize();
+                // writer.optimize(); /* Optimize is done by addIndexes */
+                writer.close();
 
                 // Write the core index to disk.
                 IndexWriter fsWriter = new IndexWriter(tempPath.getCanonicalPath(), analyzer, true);
                 fsWriter.addIndexes(new Directory[] { ramDir });
                 fsWriter.close();
 
-                writer.close();
+                // Free up the space used by the ram directory
+                ramDir.close();
 
                 job.setCancelable(false);
                 if (!job.isFinished())

Modified: trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java
===================================================================
--- trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java	2007-03-16 21:16:26 UTC (rev 1253)
+++ trunk/jsword/src/main/java/org/crosswire/jsword/index/lucene/LuceneIndexManager.java	2007-03-19 22:07:43 UTC (rev 1254)
@@ -57,8 +57,7 @@
         try
         {
             URL storage = getStorageArea(book);
-            URL longer = NetUtil.lengthenURL(storage, DIR_SEGMENTS);
-            return NetUtil.isFile(longer);
+            return NetUtil.isDirectory(storage);
         }
         catch (IOException ex)
         {
@@ -202,12 +201,7 @@
      */
     protected static final Map INDEXES = new HashMap();
 
-    /**
-     * The segments directory
-     */
-    private static final String DIR_SEGMENTS = "segments"; //$NON-NLS-1$
-
-    /**
+   /**
      * The lucene search index directory
      */
     private static final String DIR_LUCENE = "lucene"; //$NON-NLS-1$




More information about the jsword-svn mailing list