*******************************************************************************/
package org.simantics.db.indexing;
-import gnu.trove.map.hash.THashMap;
-import gnu.trove.set.hash.TLongHashSet;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import org.apache.lucene.document.Document;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.IndexableField;
-import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.search.MatchAllDocsQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import gnu.trove.map.hash.THashMap;
+import gnu.trove.set.hash.TLongHashSet;
+
/**
* @author Tuukka Lehtonen
* @author Antti Villberg
super.removeIndex(monitor, r, processor, key, keyValues);
}
- public List<Object[]> allDocs(IProgressMonitor monitor, Session session) throws ParseException, IOException,
- DatabaseException {
+ public List<Object[]> allDocs(IProgressMonitor monitor, Session session) throws IOException {
Query query = new MatchAllDocsQuery();
}
for(ScoreDoc scoreDoc:scoreDocs) {
-
- try {
-
- Document doc = reader.document(scoreDoc.doc);
- List<IndexableField> fs = doc.getFields();
- Object[] o = new Object[fs.size()];
- int index = 0;
- for (IndexableField f : fs) {
- String clazz = classMap.get(f.name());
- if ("Long".equals(clazz)) {
- o[index++] = Long.parseLong(f.stringValue());
- } else {
- o[index++] = f.stringValue();
- }
+ Document doc = reader.document(scoreDoc.doc);
+ List<IndexableField> fs = doc.getFields();
+ Object[] o = new Object[fs.size()];
+ int index = 0;
+ for (IndexableField f : fs) {
+ String clazz = classMap.get(f.name());
+ if ("Long".equals(clazz)) {
+ o[index++] = Long.parseLong(f.stringValue());
+ } else {
+ o[index++] = f.stringValue();
}
- result.add(o);
- } catch (CorruptIndexException e) {
- throw new DatabaseException(e);
- } catch (IOException e) {
- throw new DatabaseException(e);
}
-
+ result.add(o);
}
changeState(monitor, session, State.READY);
-
-// closeInternal();
-
+
return result;
}
try {
if(writer != null)
writer.commit();
- } catch (CorruptIndexException e) {
- e.printStackTrace();
} catch (IOException e) {
- e.printStackTrace();
+ getLogger().error("Index commit failed", e);
}
}