Skip to Content.
Sympa Menu

idok-commit - [idok-commit] idok commit r361 - branches/dmsd-threaded/java/ch/idok/service/server/search/lucene

idok-commit AT lists.psi.ch

Subject: Commit emails of the iDok project

List archive

[idok-commit] idok commit r361 - branches/dmsd-threaded/java/ch/idok/service/server/search/lucene


Chronological Thread 
  • From: "AFS account Stadler Hans Christian" <stadler_h AT savannah.psi.ch>
  • To: idok-commit AT lists.psi.ch
  • Subject: [idok-commit] idok commit r361 - branches/dmsd-threaded/java/ch/idok/service/server/search/lucene
  • Date: Mon, 4 May 2009 15:03:28 +0200
  • List-archive: <https://lists.web.psi.ch/pipermail/idok-commit/>
  • List-id: Commit emails of the iDok project <idok-commit.lists.psi.ch>

Author: stadler_h
Date: Mon May 4 15:03:27 2009
New Revision: 361

Log:
Check for nonexistent search index

Modified:

branches/dmsd-threaded/java/ch/idok/service/server/search/lucene/LuceneSearchService.java

Modified:
branches/dmsd-threaded/java/ch/idok/service/server/search/lucene/LuceneSearchService.java
==============================================================================
---
branches/dmsd-threaded/java/ch/idok/service/server/search/lucene/LuceneSearchService.java
(original)
+++
branches/dmsd-threaded/java/ch/idok/service/server/search/lucene/LuceneSearchService.java
Mon May 4 15:03:27 2009
@@ -51,6 +51,7 @@
import org.apache.lucene.search.highlight.Highlighter;
import org.apache.lucene.search.highlight.QueryScorer;
import org.apache.lucene.search.highlight.TokenGroup;
+import org.apache.lucene.store.FSDirectory;

import ch.idok.common.config.Setup;
import ch.idok.common.errorhandling.DmsException;
@@ -605,8 +606,10 @@
throws DmsException {
IndexReader indexReader = null;
try {
- String indexStr = getIndexString(repository);
- indexReader = IndexReader.open(indexStr);
+ File indexDir = new File(getIndexString(repository));
+ if (! indexDir.exists())
+ DmsException.throwIt(ErrorType.INDEX_ACCESS, this, "Index
for "+repository+" doesn't exist", "Index directory doesn't exist");
+ indexReader =
IndexReader.open(FSDirectory.getDirectory(indexDir), true);
Collection<Object> fields = indexReader
.getFieldNames(FieldOption.ALL);
String[] res = new String[fields.size()];
@@ -615,6 +618,8 @@
res[fieldIdx++] = (String) field;
}
return res;
+ } catch (DmsException ex) {
+ throw ex;
} catch (IOException ex) {
throw new DmsException(ErrorType.INDEX_ACCESS, this,
"Cannot open index for " + repository,



  • [idok-commit] idok commit r361 - branches/dmsd-threaded/java/ch/idok/service/server/search/lucene, AFS account Stadler Hans Christian, 05/04/2009

Archive powered by MHonArc 2.6.19.

Top of Page