use of org.apache.lucene.store.RAMDirectory in project neo4j-mobile-android by neo4j-contrib.
the class FullTxData method ensureLuceneDataInstantiated.
private void ensureLuceneDataInstantiated() {
if (this.directory == null) {
try {
this.directory = new RAMDirectory();
IndexWriterConfig writerConfig = new IndexWriterConfig(LUCENE_VERSION, index.type.analyzer);
this.writer = new IndexWriter(directory, writerConfig);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
use of org.apache.lucene.store.RAMDirectory in project graphdb by neo4j-attic.
the class FullTxData method ensureLuceneDataInstantiated.
private void ensureLuceneDataInstantiated() {
if (this.directory == null) {
try {
this.directory = new RAMDirectory();
this.writer = new IndexWriter(directory, index.type.analyzer, MaxFieldLength.UNLIMITED);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
use of org.apache.lucene.store.RAMDirectory in project neo4j by neo4j.
the class FullTxData method ensureLuceneDataInstantiated.
private void ensureLuceneDataInstantiated() {
if (this.directory == null) {
try {
this.directory = new RAMDirectory();
IndexWriterConfig writerConfig = new IndexWriterConfig(index.type.analyzer);
this.writer = new IndexWriter(directory, writerConfig);
} catch (IOException e) {
throw new RuntimeException(e);
}
}
}
use of org.apache.lucene.store.RAMDirectory in project orientdb by orientechnologies.
the class OLuceneDirectoryFactory method createDirectory.
private Directory createDirectory(ODatabaseDocumentInternal database, String indexName, ODocument metadata, String luceneType) {
String luceneBasePath = metadata.containsField(DIRECTORY_PATH) ? metadata.<String>field(DIRECTORY_PATH) : OLUCENE_BASE_DIR;
Path luceneIndexPath = Paths.get(database.getStorage().getConfiguration().getDirectory(), luceneBasePath, indexName);
try {
if (DIRECTORY_NIO.equals(luceneType)) {
return new NIOFSDirectory(luceneIndexPath);
}
if (DIRECTORY_MMAP.equals(luceneType)) {
return new MMapDirectory(luceneIndexPath);
}
} catch (IOException e) {
OLogManager.instance().error(this, "unable to create Lucene Directory with type " + luceneType, e);
}
OLogManager.instance().warn(this, "unable to create Lucene Directory, FALL BACK to ramDir");
return new RAMDirectory();
}
use of org.apache.lucene.store.RAMDirectory 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");
}
Aggregations