Search in sources :

Example 1 with DefaultIndexReaderFactory

use of org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory in project jackrabbit-oak by apache.

the class HybridIndexClusterIT method customize.

@Override
protected Jcr customize(Jcr jcr) {
    IndexCopier copier;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    MountInfoProvider mip = defaultMountInfoProvider();
    NRTIndexFactory nrtIndexFactory = new NRTIndexFactory(copier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
    LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
    IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
    LuceneIndexProvider provider = new LuceneIndexProvider(tracker);
    DocumentQueue queue = new DocumentQueue(100, tracker, sameThreadExecutor());
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, tracker, null, null, mip);
    editorProvider.setIndexingQueue(queue);
    LocalIndexObserver localIndexObserver = new LocalIndexObserver(queue, StatisticsProvider.NOOP);
    ExternalIndexObserver externalIndexObserver = new ExternalIndexObserver(queue, tracker, StatisticsProvider.NOOP);
    QueryEngineSettings qs = new QueryEngineSettings();
    qs.setFailTraversal(true);
    jcr.with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(externalIndexObserver).with(editorProvider).with(qs).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    return jcr;
}
Also used : IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) QueryEngineSettings(org.apache.jackrabbit.oak.query.QueryEngineSettings) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) Mounts.defaultMountInfoProvider(org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Example 2 with DefaultIndexReaderFactory

use of org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory in project jackrabbit-oak by apache.

the class DocumentQueueTest method createTracker.

private IndexTracker createTracker() throws IOException {
    IndexCopier indexCopier = new IndexCopier(sameThreadExecutor(), temporaryFolder.getRoot());
    indexFactory = new NRTIndexFactory(indexCopier, clock, TimeUnit.MILLISECONDS.toSeconds(refreshDelta), StatisticsProvider.NOOP);
    return new IndexTracker(new DefaultIndexReaderFactory(defaultMountInfoProvider(), indexCopier), indexFactory);
}
Also used : IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)

Example 3 with DefaultIndexReaderFactory

use of org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory in project jackrabbit-oak by apache.

the class MultiplexingLucenePropertyIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    IndexCopier copier = null;
    try {
        copier = new IndexCopier(executorService, temporaryFolder.getRoot());
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider(copier, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100), null, mip);
    LuceneIndexProvider provider = new LuceneIndexProvider(new IndexTracker(new DefaultIndexReaderFactory(mip, copier)));
    nodeStore = new MemoryNodeStore();
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).createContentRepository();
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) IOException(java.io.IOException) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) InitialContent(org.apache.jackrabbit.oak.InitialContent) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)

Example 4 with DefaultIndexReaderFactory

use of org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory in project jackrabbit-oak by apache.

the class HybridIndexTest method prepareLuceneIndexer.

private void prepareLuceneIndexer(File workDir) {
    try {
        indexCopierDir = createTemporaryFolderIn(workDir);
        copier = new IndexCopier(executorService, indexCopierDir, true);
    } catch (IOException e) {
        throw new RuntimeException(e);
    }
    nrtIndexFactory = new NRTIndexFactory(copier, Clock.SIMPLE, TimeUnit.MILLISECONDS.toSeconds(refreshDeltaMillis), StatisticsProvider.NOOP);
    MountInfoProvider mip = Mounts.defaultMountInfoProvider();
    LuceneIndexReaderFactory indexReaderFactory = new DefaultIndexReaderFactory(mip, copier);
    IndexTracker tracker = new IndexTracker(indexReaderFactory, nrtIndexFactory);
    luceneIndexProvider = new LuceneIndexProvider(tracker);
    luceneEditorProvider = new LuceneIndexEditorProvider(copier, tracker, //extractedTextCache
    null, //augmentorFactory
    null, mip);
    queue = new DocumentQueue(queueSize, tracker, executorService, statsProvider);
    localIndexObserver = new LocalIndexObserver(queue, statsProvider);
    luceneEditorProvider.setIndexingQueue(queue);
}
Also used : LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) LocalIndexObserver(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver) NRTIndexFactory(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory) DocumentQueue(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) MountInfoProvider(org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)

Example 5 with DefaultIndexReaderFactory

use of org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory in project jackrabbit-oak by apache.

the class LuceneIndexProviderService method createTracker.

private IndexTracker createTracker(BundleContext bundleContext, Map<String, ?> config) throws IOException {
    boolean enableCopyOnRead = PropertiesUtil.toBoolean(config.get(PROP_COPY_ON_READ), true);
    if (enableCopyOnRead) {
        initializeIndexCopier(bundleContext, config);
        log.info("Enabling CopyOnRead support. Index files would be copied under {}", indexDir.getAbsolutePath());
        if (hybridIndex) {
            nrtIndexFactory = new NRTIndexFactory(indexCopier, statisticsProvider);
        }
        return new IndexTracker(new DefaultIndexReaderFactory(mountInfoProvider, indexCopier), nrtIndexFactory);
    }
    return new IndexTracker();
}
Also used : NRTIndexFactory(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory) DefaultIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)

Aggregations

DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)9 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)5 IndexTracker (org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker)5 IOException (java.io.IOException)4 LuceneIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory)4 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)3 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)3 NRTIndexFactory (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory)3 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)3 InitialContent (org.apache.jackrabbit.oak.InitialContent)2 Oak (org.apache.jackrabbit.oak.Oak)2 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)2 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)2 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)2 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)2 Mounts.defaultMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider)2 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)2 Stopwatch (com.google.common.base.Stopwatch)1 MoreExecutors.sameThreadExecutor (com.google.common.util.concurrent.MoreExecutors.sameThreadExecutor)1 Executor (java.util.concurrent.Executor)1