use of org.apache.lucene.index.TrackingIndexWriter in project orientdb by orientechnologies.
the class OLuceneStorage method reOpen.
private void reOpen() throws IOException {
if (mgrWriter != null) {
OLogManager.instance().info(this, "index storage is open don't reopen");
return;
}
ODatabaseDocumentInternal database = ODatabaseRecordThreadLocal.INSTANCE.get();
final OAbstractPaginatedStorage storageLocalAbstract = (OAbstractPaginatedStorage) database.getStorage().getUnderlying();
Directory dir = null;
if (storageLocalAbstract instanceof OLocalPaginatedStorage) {
String pathname = getIndexPath((OLocalPaginatedStorage) storageLocalAbstract);
OLogManager.instance().info(this, "Opening NIOFS Lucene db=%s, path=%s", database.getName(), pathname);
dir = NIOFSDirectory.open(new File(pathname).toPath());
} else {
OLogManager.instance().info(this, "Opening RAM Lucene index db=%s", database.getName());
dir = new RAMDirectory();
}
final IndexWriter indexWriter = createIndexWriter(dir);
mgrWriter = new TrackingIndexWriter(indexWriter);
searcherManager = new SearcherManager(indexWriter, true, null);
if (nrt != null) {
nrt.close();
}
nrt = new ControlledRealTimeReopenThread(mgrWriter, searcherManager, 60.00, 0.1);
nrt.setDaemon(true);
nrt.start();
flush();
OLogManager.instance().info(this, "REOPEN DONE");
}
use of org.apache.lucene.index.TrackingIndexWriter in project orientdb by orientechnologies.
the class OLuceneIndexEngineAbstract method open.
private void open(final ODocument metadata) throws IOException {
OLuceneDirectoryFactory directoryFactory = new OLuceneDirectoryFactory();
directory = directoryFactory.createDirectory(getDatabase(), name, metadata);
final IndexWriter indexWriter = createIndexWriter(directory);
mgrWriter = new TrackingIndexWriter(indexWriter);
searcherManager = new SearcherManager(indexWriter, true, null);
reopenToken = 0;
nrt = new ControlledRealTimeReopenThread(mgrWriter, searcherManager, 60.00, 0.1);
nrt.setDaemon(true);
nrt.start();
closed.set(false);
flush();
}
use of org.apache.lucene.index.TrackingIndexWriter in project orientdb by orientechnologies.
the class OLuceneIndexEngineAbstract method open.
private synchronized void open() throws IOException {
if (!closed.get())
return;
OLuceneDirectoryFactory directoryFactory = new OLuceneDirectoryFactory();
directory = directoryFactory.createDirectory(getDatabase(), name, metadata);
final IndexWriter indexWriter = createIndexWriter(directory);
mgrWriter = new TrackingIndexWriter(indexWriter);
searcherManager = new SearcherManager(indexWriter, true, null);
reopenToken = 0;
startNRT();
closed.set(false);
flush();
scheduleCommitTask();
}
Aggregations