[jsword-svn] jsword/java/jsword/org/crosswire/jsword/book/search/lucene s

jswordcvs at crosswire.org jswordcvs at crosswire.org
Tue Mar 8 05:27:28 MST 2005


Update of /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene
In directory www.crosswire.org:/tmp/cvs-serv12038/java/jsword/org/crosswire/jsword/book/search/lucene

Modified Files:
	LuceneIndex.java LuceneIndexManager.java 
Log Message:
Cancelling of Index now fully works.

Index: LuceneIndex.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/LuceneIndex.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** LuceneIndex.java	8 Mar 2005 02:31:45 -0000	1.7
--- LuceneIndex.java	8 Mar 2005 12:27:25 -0000	1.8
***************
*** 100,103 ****
--- 100,104 ----
          Job job = JobManager.createJob(Msg.INDEX_START.toString(), Thread.currentThread(), false);
  
+         IndexStatus finalStatus = IndexStatus.UNDONE;
          try
          {
***************
*** 107,111 ****
                  File finalPath = NetUtil.getAsFile(storage);
                  String finalCanonicalPath = finalPath.getCanonicalPath();
!                 File tempPath = new File(finalCanonicalPath + ".building"); //$NON-NLS-1$
                  
                  // An index is created by opening an IndexWriter with the
--- 108,112 ----
                  File finalPath = NetUtil.getAsFile(storage);
                  String finalCanonicalPath = finalPath.getCanonicalPath();
!                 File tempPath = new File(finalCanonicalPath + '.' + IndexStatus.CREATING.toString());
                  
                  // An index is created by opening an IndexWriter with the
***************
*** 127,132 ****
  
                      searcher = new IndexSearcher(finalPath.getCanonicalPath());
  
!                     book.getBookMetaData().setIndexStatus(IndexStatus.DONE);
                  }
              }
--- 128,136 ----
  
                      searcher = new IndexSearcher(finalPath.getCanonicalPath());
+                 }
  
!                 if (finalPath.exists())
!                 {
!                     finalStatus = IndexStatus.DONE;
                  }
              }
***************
*** 139,142 ****
--- 143,147 ----
          finally
          {
+             book.getBookMetaData().setIndexStatus(finalStatus);
              job.done();
          }

Index: LuceneIndexManager.java
===================================================================
RCS file: /cvs/jsword/jsword/java/jsword/org/crosswire/jsword/book/search/lucene/LuceneIndexManager.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** LuceneIndexManager.java	8 Mar 2005 02:31:45 -0000	1.6
--- LuceneIndexManager.java	8 Mar 2005 12:27:25 -0000	1.7
***************
*** 97,107 ****
              public void run()
              {
                  try
                  {
!                     URL storage = getStorageArea(book.getBookMetaData());
                      Index index = new LuceneIndex(book, storage, true);
                      // We were successful if the directory exists.
                      if (NetUtil.getAsFile(storage).exists())
                      {
                          INDEXES.put(book, index);
                      }
--- 97,110 ----
              public void run()
              {
+                 IndexStatus finalStatus = IndexStatus.UNDONE;
+                 URL storage = null;
                  try
                  {
!                     storage = getStorageArea(book.getBookMetaData());
                      Index index = new LuceneIndex(book, storage, true);
                      // We were successful if the directory exists.
                      if (NetUtil.getAsFile(storage).exists())
                      {
+                         finalStatus = IndexStatus.DONE;
                          INDEXES.put(book, index);
                      }
***************
*** 111,114 ****
--- 114,121 ----
                      Reporter.informUser(LuceneIndexManager.this, ex);
                  }
+                 finally
+                 {
+                     book.getBookMetaData().setIndexStatus(finalStatus);
+                 }
              }
          });



More information about the jsword-svn mailing list