Search in sources :

Example 1 with ElasticIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider in project jackrabbit-oak by apache.

the class ElasticFacetTest method createRepository.

private void createRepository() throws RepositoryException {
    ElasticConnection connection = elasticRule.useDocker() ? elasticRule.getElasticConnectionForDocker() : elasticRule.getElasticConnectionFromString();
    ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
    ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
    ElasticIndexProvider indexProvider = new ElasticIndexProvider(indexTracker);
    NodeStore nodeStore = new MemoryNodeStore(INITIAL_CONTENT);
    Oak oak = new Oak(nodeStore).with(editorProvider).with(indexTracker).with(indexProvider);
    Jcr jcr = new Jcr(oak);
    Repository repository = jcr.createRepository();
    adminSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), null);
    // we'd always query anonymously
    anonymousSession = repository.login(new GuestCredentials(), null);
    anonymousSession.refresh(true);
    anonymousSession.save();
    qe = anonymousSession.getWorkspace().getQueryManager();
}
Also used : ElasticIndexProvider(org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider) ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) SimpleCredentials(javax.jcr.SimpleCredentials) Repository(javax.jcr.Repository) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider) GuestCredentials(javax.jcr.GuestCredentials)

Example 2 with ElasticIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider in project jackrabbit-oak by apache.

the class ElasticReindexTest method createRepository.

private void createRepository() throws RepositoryException {
    ElasticConnection connection = elasticRule.useDocker() ? elasticRule.getElasticConnectionForDocker() : elasticRule.getElasticConnectionFromString();
    ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
    ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
    ElasticIndexProvider indexProvider = new ElasticIndexProvider(indexTracker);
    NodeStore nodeStore = new MemoryNodeStore(INITIAL_CONTENT);
    Oak oak = new Oak(nodeStore).with(new OpenSecurityProvider()).with(editorProvider).with(indexTracker).with(indexProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider());
    Jcr jcr = new Jcr(oak);
    Repository repository = jcr.createRepository();
    adminSession = repository.login(new SimpleCredentials("admin", "admin".toCharArray()), null);
    qe = adminSession.getWorkspace().getQueryManager();
}
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) ElasticIndexProvider(org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider) ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) SimpleCredentials(javax.jcr.SimpleCredentials) Repository(javax.jcr.Repository) NodeStore(org.apache.jackrabbit.oak.spi.state.NodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) MemoryNodeStore(org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore) Oak(org.apache.jackrabbit.oak.Oak) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Example 3 with ElasticIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider in project jackrabbit-oak by apache.

the class ElasticFacetSearchTest method createRepository.

@Override
protected Repository[] createRepository(RepositoryFixture fixture) throws Exception {
    indexName = TestHelper.getUniqueIndexName("elasticFacetTest");
    Map<String, Boolean> propMap = new LinkedHashMap<>();
    propMap.put(SEARCH_PROP, false);
    propMap.put(FACET_PROP_1, true);
    propMap.put(FACET_PROP_2, true);
    if (fixture instanceof OakRepositoryFixture) {
        return ((OakRepositoryFixture) fixture).setUpCluster(1, oak -> {
            ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
            ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
            ElasticIndexProvider indexProvider = new ElasticIndexProvider(indexTracker);
            oak.with(editorProvider).with(indexTracker).with(indexProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).with(new FacetIndexInitializer(indexName, propMap, ElasticIndexDefinition.TYPE_ELASTICSEARCH, getFacetMode()));
            return new Jcr(oak);
        });
    }
    return super.createRepository(fixture);
}
Also used : OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) ElasticIndexProvider(org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider) LinkedHashMap(java.util.LinkedHashMap) ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Example 4 with ElasticIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider in project jackrabbit-oak by apache.

the class ElasticPropertyFTSeparatedIndexedContentAvailability method createRepository.

@Override
protected Repository[] createRepository(RepositoryFixture fixture) throws Exception {
    elasticGlobalIndexName = TestHelper.getUniqueIndexName("elasticGlobal");
    elasticTitleIndexName = TestHelper.getUniqueIndexName("elasticTitle");
    if (fixture instanceof OakRepositoryFixture) {
        currentFixtureName = fixture.toString();
        return ((OakRepositoryFixture) fixture).setUpCluster(1, oak -> {
            ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
            ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
            ElasticIndexProvider indexProvider = new ElasticIndexProvider(indexTracker);
            oak.with(editorProvider).with(indexProvider).with(indexProvider).with((new ElasticGlobalInitializer(elasticGlobalIndexName, storageEnabled)).async("fulltext-async")).with(new FullTextPropertyInitialiser(elasticTitleIndexName, Collections.singleton("title"), ElasticIndexDefinition.TYPE_ELASTICSEARCH).async()).withAsyncIndexing("async", 5).withAsyncIndexing("fulltext-async", 5);
            return new Jcr(oak);
        });
    }
    return super.createRepository(fixture);
}
Also used : ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) ElasticGlobalInitializer(org.apache.jackrabbit.oak.benchmark.util.ElasticGlobalInitializer) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) ElasticIndexProvider(org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Example 5 with ElasticIndexProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider in project jackrabbit-oak by apache.

the class ElasticPropertyTextSearchTest method createRepository.

@Override
protected Repository[] createRepository(RepositoryFixture fixture) throws Exception {
    indexName = TestHelper.getUniqueIndexName("elasticTitle");
    if (fixture instanceof OakRepositoryFixture) {
        return ((OakRepositoryFixture) fixture).setUpCluster(1, oak -> {
            ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
            ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
            ElasticIndexProvider indexProvider = new ElasticIndexProvider(indexTracker);
            oak.with(editorProvider).with(indexProvider).with(indexProvider).with(new PropertyIndexEditorProvider()).with(new NodeTypeIndexProvider()).with(new PropertyFullTextTest.FullTextPropertyInitialiser(indexName, Collections.singleton("title"), ElasticIndexDefinition.TYPE_ELASTICSEARCH));
            return new Jcr(oak);
        });
    }
    return super.createRepository(fixture);
}
Also used : ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) OakRepositoryFixture(org.apache.jackrabbit.oak.fixture.OakRepositoryFixture) NodeTypeIndexProvider(org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) Jcr(org.apache.jackrabbit.oak.jcr.Jcr) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) PropertyIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider) ElasticIndexProvider(org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Aggregations

ElasticIndexProvider (org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider)11 ElasticIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)10 ExtractedTextCache (org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache)10 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)9 OakRepositoryFixture (org.apache.jackrabbit.oak.fixture.OakRepositoryFixture)6 ElasticIndexTracker (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker)6 ElasticMetricHandler (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler)6 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)6 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)6 Oak (org.apache.jackrabbit.oak.Oak)4 Repository (javax.jcr.Repository)3 SimpleCredentials (javax.jcr.SimpleCredentials)3 ElasticGlobalInitializer (org.apache.jackrabbit.oak.benchmark.util.ElasticGlobalInitializer)3 MemoryNodeStore (org.apache.jackrabbit.oak.plugins.memory.MemoryNodeStore)3 NodeStore (org.apache.jackrabbit.oak.spi.state.NodeStore)3 GuestCredentials (javax.jcr.GuestCredentials)2 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)2 Hashtable (java.util.Hashtable)1 LinkedHashMap (java.util.LinkedHashMap)1 TrackingCorruptIndexHandler (org.apache.jackrabbit.oak.plugins.index.TrackingCorruptIndexHandler)1