public void closeIndexer(){ try { writer.close(); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public Document getDocumentWithDocID(int docID) { try { return searcher.doc(docID); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
public void addDoc(Document doc) { try { writer.addDocument(doc); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
public Document getDocumentWithDocId(int docId) { try { return reader.document(docId); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } return null; }
private void openIndex() { try { this.reader = IndexReader.open(this.index); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
private void openIndexWriter() { if(writer!=null) closeIndexer(); try { writer = new IndexWriter(index, config); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
private void setIndexReader(Directory indexDir) { try { this.reader = IndexReader.open(indexDir); indexDir.close(); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } }
/** * Flush any pending transactions and re-open the reader. */ public void flush() { try { synchronized (getLock()) { if ( writer != null) { writer.commit(); } if ( reader != null ){ reopenReaderIfNeeded(); } } } catch (CorruptIndexException e) { // really? Throws from Open, which should have been a empty database. System.out.println("Index for " + name + " corrupt at flush..." + e); needsReset = true; e.printStackTrace(); } catch (IOException e) { // really? Disk going bad. Doesn't mater what we do from here on out. Keep running with the // current ram index though. System.out.println("Index for " + name + " ioexception at flush..." + e); e.printStackTrace(); } }
System.out.println("Finished"); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace();
e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace();
/** * Create a version of the vector store indexes by path / filename rather than Lucene ID. */ public VectorStore makeWriteableVectorStore() { VectorStoreRAM outputVectors = new VectorStoreRAM(flagConfig); for (int i = 0; i < this.luceneUtils.getNumDocs(); ++i) { try { String externalDocId = luceneUtils.getExternalDocId(i); Vector docVector = this.docVectors.getVector(externalDocId); outputVectors.putVector(externalDocId, docVector); } catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } return outputVectors; }
} catch (CorruptIndexException e) { e.printStackTrace(); } catch (IOException e) {
e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace();
e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace();
e.printStackTrace(); } catch (LockObtainFailedException e) { e.printStackTrace();
e.printStackTrace(); } catch (IOException e) {
@Override public void run() { long cycleTime = 50000000; long start = System.nanoTime(); while (_running.get()) { try { Collection<Document> docs = _queue.take(); _writer.addDocuments(docs); if (start + cycleTime < System.nanoTime()) { IndexReader newReader = IndexReader.open(_writer, true); _reader.close(); _reader = newReader; start = System.nanoTime(); } } catch (InterruptedException e) { return; } catch (CorruptIndexException e) { e.printStackTrace(); return; } catch (IOException e) { e.printStackTrace(); return; } } } }
e.printStackTrace(); } catch (IOException e) { disableLucene = true;