Search in sources :

Example 6 with LuceneIndexProvider

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

the class ActiveDeletedBlobCollectionIT method createRepository.

@Override
protected ContentRepository createRepository() {
    adbc = new ActiveDeletedBlobCollectorImpl(clock, new File(blobCollectionRoot.getRoot(), "deleted-blobs"), executorService);
    IndexCopier copier = createIndexCopier();
    editorProvider = new LuceneIndexEditorProvider(copier, null, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100), null, Mounts.defaultMountInfoProvider(), adbc);
    provider = new LuceneIndexProvider(copier);
    mongoConnection = connectionFactory.getConnection();
    MongoUtils.dropCollections(mongoConnection.getDatabase());
    if (dataStoreType == DataStoreType.WITHOUT_FDS) {
        MongoBlobStore blobStore = new MongoBlobStore(mongoConnection.getDatabase());
        blobStore.setBlockSize(128);
        blobStore.setBlockSizeMin(48);
        this.blobStore = new CountingBlobStore(blobStore);
    } else {
        FileDataStore fds = new FileDataStore();
        fds.init(fileDataStoreRoot.getRoot().getAbsolutePath());
        DataStoreBlobStore dsbs = new DataStoreBlobStore(fds);
        dsbs.setBlockSize(128);
        this.blobStore = new CountingBlobStore(dsbs);
    }
    nodeStore = new DocumentMK.Builder().setMongoDB(mongoConnection.getMongoClient(), mongoConnection.getDBName()).setBlobStore(this.blobStore).getNodeStore();
    asyncIndexUpdate = new AsyncIndexUpdate("async", nodeStore, editorProvider);
    return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).createContentRepository();
}
Also used : MongoBlobStore(org.apache.jackrabbit.oak.plugins.document.mongo.MongoBlobStore) ActiveDeletedBlobCollectorImpl(org.apache.jackrabbit.oak.plugins.index.lucene.directory.ActiveDeletedBlobCollectorFactory.ActiveDeletedBlobCollectorImpl) AsyncIndexUpdate(org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache) InitialContent(org.apache.jackrabbit.oak.InitialContent) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) Oak(org.apache.jackrabbit.oak.Oak) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) File(java.io.File) FileDataStore(org.apache.jackrabbit.core.data.FileDataStore) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)

Example 7 with LuceneIndexProvider

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

the class ActiveDeletedBlobSyncTrackerTest method createRepository.

@Override
protected ContentRepository createRepository() {
    try {
        File blobCollectorDeleted = new File(blobCollectionRoot.getRoot(), "deleted-blobs");
        blobCollectorDeleted.mkdirs();
        adbc = new ActiveDeletedBlobCollectorImpl(clock, new File(blobCollectionRoot.getRoot(), "deleted-blobs"), executorService);
        IndexCopier copier = createIndexCopier();
        editorProvider = new LuceneIndexEditorProvider(copier, null, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100), null, Mounts.defaultMountInfoProvider(), adbc);
        provider = new LuceneIndexProvider(copier);
        OakFileDataStore ds = new OakFileDataStore();
        ds.setMinRecordLength(10);
        ds.init(fileDataStoreRoot.getRoot().getAbsolutePath());
        DataStoreBlobStore dsbs = new DataStoreBlobStore(ds);
        this.blobStore = new AbstractActiveDeletedBlobTest.CountingBlobStore(dsbs);
        FileStore store = FileStoreBuilder.fileStoreBuilder(temporaryFolder.getRoot()).withMemoryMapping(false).withBlobStore(blobStore).build();
        nodeStore = SegmentNodeStoreBuilders.builder(store).build();
        BlobTrackingStore trackingStore = (BlobTrackingStore) blobStore;
        trackingStore.addTracker(new BlobIdTracker(blobTrackerRoot.getRoot().getAbsolutePath(), getOrCreateId(nodeStore), 600, dsbs));
        // set the blob store to skip writing blobs through the node store
        editorProvider.setBlobStore(blobStore);
        asyncIndexUpdate = new AsyncIndexUpdate("async", nodeStore, editorProvider);
        return new Oak(nodeStore).with(new InitialContent()).with(new OpenSecurityProvider()).with((QueryIndexProvider) provider).with((Observer) provider).with(editorProvider).createContentRepository();
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
Also used : OakFileDataStore(org.apache.jackrabbit.oak.plugins.blob.datastore.OakFileDataStore) ActiveDeletedBlobCollectorImpl(org.apache.jackrabbit.oak.plugins.index.lucene.directory.ActiveDeletedBlobCollectorFactory.ActiveDeletedBlobCollectorImpl) AsyncIndexUpdate(org.apache.jackrabbit.oak.plugins.index.AsyncIndexUpdate) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) IndexCopier(org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier) IOException(java.io.IOException) QueryIndexProvider(org.apache.jackrabbit.oak.spi.query.QueryIndexProvider) ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache) InitialContent(org.apache.jackrabbit.oak.InitialContent) FileStore(org.apache.jackrabbit.oak.segment.file.FileStore) BlobIdTracker(org.apache.jackrabbit.oak.plugins.blob.datastore.BlobIdTracker) LuceneIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider) BlobTrackingStore(org.apache.jackrabbit.oak.plugins.blob.BlobTrackingStore) Oak(org.apache.jackrabbit.oak.Oak) LuceneIndexProvider(org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider) File(java.io.File) DataStoreBlobStore(org.apache.jackrabbit.oak.plugins.blob.datastore.DataStoreBlobStore)

Example 8 with LuceneIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider 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 9 with LuceneIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider 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 10 with LuceneIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider 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)

Aggregations

LuceneIndexProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexProvider)14 LuceneIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.lucene.LuceneIndexEditorProvider)12 Oak (org.apache.jackrabbit.oak.Oak)8 IndexCopier (org.apache.jackrabbit.oak.plugins.index.lucene.IndexCopier)8 IOException (java.io.IOException)6 IndexTracker (org.apache.jackrabbit.oak.plugins.index.lucene.IndexTracker)6 DefaultIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.DefaultIndexReaderFactory)6 Observer (org.apache.jackrabbit.oak.spi.commit.Observer)6 MountInfoProvider (org.apache.jackrabbit.oak.spi.mount.MountInfoProvider)6 LuceneIndexReaderFactory (org.apache.jackrabbit.oak.plugins.index.lucene.reader.LuceneIndexReaderFactory)5 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)5 InitialContent (org.apache.jackrabbit.oak.InitialContent)4 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)4 DocumentQueue (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.DocumentQueue)4 NRTIndexFactory (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.NRTIndexFactory)4 QueryIndexProvider (org.apache.jackrabbit.oak.spi.query.QueryIndexProvider)4 Repository (javax.jcr.Repository)3 SimpleCredentials (javax.jcr.SimpleCredentials)3 ExtractedTextCache (org.apache.jackrabbit.oak.plugins.index.lucene.ExtractedTextCache)3 LocalIndexObserver (org.apache.jackrabbit.oak.plugins.index.lucene.hybrid.LocalIndexObserver)3