Search in sources :

Example 1 with DirectoryManager

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);
}
Also used : RAMDirectoryManager(org.apache.jackrabbit.core.query.lucene.directory.RAMDirectoryManager) StandardAnalyzer(org.apache.lucene.analysis.standard.StandardAnalyzer) ArrayList(java.util.ArrayList) DirectoryManager(org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager) RAMDirectoryManager(org.apache.jackrabbit.core.query.lucene.directory.RAMDirectoryManager) Document(org.apache.lucene.document.Document) RAMDirectory(org.apache.lucene.store.RAMDirectory)

Example 2 with DirectoryManager

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;
    }
}
Also used : FSDirectoryManager(org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager) DirectoryManager(org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager) IOException(java.io.IOException) FileSystemException(org.apache.jackrabbit.core.fs.FileSystemException) SAXException(org.xml.sax.SAXException) JournalException(org.apache.jackrabbit.core.journal.JournalException) NoSuchItemStateException(org.apache.jackrabbit.core.state.NoSuchItemStateException) RepositoryException(javax.jcr.RepositoryException) MalformedURLException(java.net.MalformedURLException) IOException(java.io.IOException) ItemStateException(org.apache.jackrabbit.core.state.ItemStateException) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) InvalidQueryException(javax.jcr.query.InvalidQueryException)

Aggregations

DirectoryManager (org.apache.jackrabbit.core.query.lucene.directory.DirectoryManager)2 IOException (java.io.IOException)1 MalformedURLException (java.net.MalformedURLException)1 ArrayList (java.util.ArrayList)1 RepositoryException (javax.jcr.RepositoryException)1 InvalidQueryException (javax.jcr.query.InvalidQueryException)1 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)1 FileSystemException (org.apache.jackrabbit.core.fs.FileSystemException)1 JournalException (org.apache.jackrabbit.core.journal.JournalException)1 FSDirectoryManager (org.apache.jackrabbit.core.query.lucene.directory.FSDirectoryManager)1 RAMDirectoryManager (org.apache.jackrabbit.core.query.lucene.directory.RAMDirectoryManager)1 ItemStateException (org.apache.jackrabbit.core.state.ItemStateException)1 NoSuchItemStateException (org.apache.jackrabbit.core.state.NoSuchItemStateException)1 StandardAnalyzer (org.apache.lucene.analysis.standard.StandardAnalyzer)1 Document (org.apache.lucene.document.Document)1 RAMDirectory (org.apache.lucene.store.RAMDirectory)1 SAXException (org.xml.sax.SAXException)1