X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.db.indexing%2Fsrc%2Forg%2Fsimantics%2Fdb%2Findexing%2FIndexedRelationsMemorySearcher.java;h=0275c2e00a6274a117c55b88d7fb0d8d9ae17d88;hp=8fc0ce911b32fe5f012463a8f7796fc80d0dee45;hb=ad0e5bf4b34705988e23c9ee3f8e4fcbb760c701;hpb=8b8630b93f8e4ec88a8a4eb53b55031407deedc0 diff --git a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsMemorySearcher.java b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsMemorySearcher.java index 8fc0ce911..0275c2e00 100644 --- a/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsMemorySearcher.java +++ b/bundles/org.simantics.db.indexing/src/org/simantics/db/indexing/IndexedRelationsMemorySearcher.java @@ -11,9 +11,6 @@ *******************************************************************************/ 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; @@ -23,7 +20,6 @@ import java.util.Map; 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; @@ -39,6 +35,9 @@ import org.simantics.utils.datastructures.Pair; 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 @@ -94,8 +93,7 @@ public class IndexedRelationsMemorySearcher extends IndexedRelationsSearcherBase super.removeIndex(monitor, r, processor, key, keyValues); } - public List allDocs(IProgressMonitor monitor, Session session) throws ParseException, IOException, - DatabaseException { + public List allDocs(IProgressMonitor monitor, Session session) throws IOException { Query query = new MatchAllDocsQuery(); @@ -112,34 +110,23 @@ public class IndexedRelationsMemorySearcher extends IndexedRelationsSearcherBase } for(ScoreDoc scoreDoc:scoreDocs) { - - try { - - Document doc = reader.document(scoreDoc.doc); - List 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 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; } @@ -148,10 +135,8 @@ public class IndexedRelationsMemorySearcher extends IndexedRelationsSearcherBase try { if(writer != null) writer.commit(); - } catch (CorruptIndexException e) { - e.printStackTrace(); } catch (IOException e) { - e.printStackTrace(); + getLogger().error("Index commit failed", e); } }