Search in sources :

Example 6 with LuceneIndexEditorProvider

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

the class AtomicCounterIT method setup.

@Before
public void setup() throws Exception {
    DocumentNodeStore ns = builderProvider.newBuilder().getNodeStore();
    NodeBuilder builder = ns.getRoot().builder();
    NodeBuilder index = builder.child(INDEX_DEFINITIONS_NAME);
    NodeBuilder lucene = newLuceneIndexDefinition(index, "lucene", ImmutableSet.of("String"), null, "async");
    lucene.setProperty("async", of("async", "nrt"), STRINGS);
    IndexDefinition.updateDefinition(index.child("lucene"));
    ns.merge(builder, EmptyHook.INSTANCE, CommitInfo.EMPTY);
    LuceneIndexEditorProvider editorProvider = new LuceneIndexEditorProvider();
    editorProvider.setIndexingQueue(mock(DocumentQueue.class));
    LuceneIndexProvider provider = new LuceneIndexProvider();
    ContentRepository repository = new Oak(ns).with(// Clusterable
    ns).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).with(executorService).withAtomicCounter().withAsyncIndexing("async", 1).withFailOnMissingIndexProvider().createContentRepository();
    session = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), null);
    while (isReindexing(session)) {
        Thread.sleep(100);
    }
}
Also used : SimpleCredentials(javax.jcr.SimpleCredentials) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) ContentRepository(org.apache.jackrabbit.oak.api.ContentRepository) Oak(org.apache.jackrabbit.oak.Oak) DocumentNodeStore(org.apache.jackrabbit.oak.plugins.document.DocumentNodeStore) DocumentQueue(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) Before(org.junit.Before)

Example 7 with LuceneIndexEditorProvider

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

the class LuceneOakRepositoryStub method preCreateRepository.

@Override
protected void preCreateRepository(Jcr jcr) {
    LuceneIndexProvider provider = new LuceneIndexProvider().with(getNodeAggregator());
    jcr.with(new LuceneCompatModeInitializer("luceneGlobal", (Set<String>) null)).with((QueryIndexProvider) provider).with((Observer) provider).withFastQueryResultSize(true).with(new LuceneIndexEditorProvider());
}
Also used : Set(java.util.Set) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)

Example 8 with LuceneIndexEditorProvider

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

the class JsonIndexCommand method createLuceneIndexEditorProvider.

private static LuceneIndexEditorProvider createLuceneIndexEditorProvider() {
    LuceneIndexEditorProvider ep = new LuceneIndexEditorProvider();
    ScheduledExecutorService executorService = MoreExecutors.getExitingScheduledExecutorService((ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(5));
    StatisticsProvider statsProvider = StatisticsProvider.NOOP;
    int queueSize = Integer.getInteger("queueSize", 1000);
    IndexTracker tracker = new IndexTracker();
    DocumentQueue queue = new DocumentQueue(queueSize, tracker, executorService, statsProvider);
    ep.setIndexingQueue(queue);
    return ep;
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) DocumentQueue(org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue) StatisticsProvider(org.apache.jackrabbit.oak.stats.StatisticsProvider)

Example 9 with LuceneIndexEditorProvider

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

the class MultiSessionQueryTest method before.

@Before
public void before() {
    Jcr jcr = new Jcr();
    // lucene specific
    jcr.with(new LuceneInitializerHelper("lucene").async());
    LuceneIndexProvider provider = new LuceneIndexProvider();
    jcr.with((QueryIndexProvider) provider);
    jcr.with((Observer) provider);
    jcr.with(new LuceneIndexEditorProvider());
    repository = jcr.createRepository();
}
Also used : LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) LuceneInitializerHelper(org.apache.jackrabbit.oak.plugins.index.lucene.util.LuceneInitializerHelper) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) Before(org.junit.Before)

Example 10 with LuceneIndexEditorProvider

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

the class HybridIndexTest method createRepository.

@Override
protected ContentRepository createRepository() {
    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);
    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);
    nodeStore = new MemoryNodeStore();
    Oak oak = new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(localIndexObserver).with(editorProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).with(optionalEditorProvider).with(new NodeCounterEditorProvider()).withAsyncIndexing("async", TimeUnit.DAYS.toSeconds(1));
    wb = oak.getWhiteboard();
    return oak.createContentRepository();
}
Also used : NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) IndexTracker(org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) IOException(java.io.IOException) LuceneIndexReaderFactory(org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) InitialContent(org.apache.jackrabbit.oak.InitialContent) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Observer(org.apache.jackrabbit.oak.spi.commit.Observer) Oak(org.apache.jackrabbit.oak.Oak) 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) NodeCounterEditorProvider(org.apache.jackrabbit.oak.plugins.index.counter.NodeCounterEditorProvider)

Aggregations

LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)11 LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)8 IndexTracker (org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker)5 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)4 Before (org.junit.Before)4 IOException (java.io.IOException)3 Oak (org.apache.jackrabbit.oak.Oak)3 DocumentQueue (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue)3 DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)3 LuceneIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory)3 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)3 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)3 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)3 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)3 InitialContent (org.apache.jackrabbit.oak.InitialContent)2 IndexUpdateProvider (org.apache.jackrabbit.oak.plugins.index.IndexUpdateProvider)2 EditorHook (org.apache.jackrabbit.oak.spi.commit.EditorHook)2 Mounts.defaultMountInfoProvider (org.apache.jackrabbit.oak.spi.mount.Mounts.defaultMountInfoProvider)2 File (java.io.File)1 Set (java.util.Set)1