use of org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager in project jackrabbit by apache.
the class IndexMigrationTest method testMigration.
public void testMigration() throws Exception {
List<Document> docs = new ArrayList<Document>();
docs.add(createDocument("ab", "a"));
docs.add(createDocument("a", "b"));
docs.add(createDocument("abcd", "c"));
docs.add(createDocument("abc", "d"));
DirectoryManager dirMgr = new RAMDirectoryManager();
PersistentIndex idx = new PersistentIndex("index", new StandardAnalyzer(Version.LUCENE_36), Similarity.getDefault(), new DocNumberCache(100), new IndexingQueue(new IndexingQueueStore(new RAMDirectory())), dirMgr, 0);
idx.addDocuments(docs.toArray(new Document[docs.size()]));
idx.commit();
IndexMigration.migrate(idx, dirMgr, SEP_CHAR);
}
use of org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager in project jackrabbit by apache.
the class SearchIndex method createDirectoryManager.
/**
* @return an initialized {@link DirectoryManager}.
* @throws IOException if the directory manager cannot be instantiated or
* an exception occurs while initializing the manager.
*/
protected DirectoryManager createDirectoryManager() throws IOException {
try {
Class<?> clazz = Class.forName(directoryManagerClass);
if (!DirectoryManager.class.isAssignableFrom(clazz)) {
throw new IOException(directoryManagerClass + " is not a DirectoryManager implementation");
}
DirectoryManager df = (DirectoryManager) clazz.newInstance();
df.init(this);
return df;
} catch (IOException e) {
throw e;
} catch (Exception e) {
IOException ex = new IOException();
ex.initCause(e);
throw ex;
}
}
Aggregations