Search in sources :

Example 1 with ElasticIndexEditorProvider

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

the class ElasticIndexImporterSupport method createElasticEditorProvider.

private IndexEditorProvider createElasticEditorProvider() {
    final ElasticConnection.Builder.BuildStep buildStep = ElasticConnection.newBuilder().withIndexPrefix(indexPrefix).withConnectionParameters(scheme, host, port);
    final ElasticConnection connection;
    if (apiKeyId != null && apiSecretId != null) {
        connection = buildStep.withApiKeys(apiKeyId, apiSecretId).build();
    } else {
        connection = buildStep.build();
    }
    closer.register(connection);
    ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
    ElasticIndexEditorProvider editorProvider = new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
    return editorProvider;
}
Also used : ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) ElasticConnection(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Example 2 with ElasticIndexEditorProvider

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

the class ElasticOutOfBandIndexer method createElasticEditorProvider.

private IndexEditorProvider createElasticEditorProvider() {
    final ElasticConnection.Builder.BuildStep buildStep = ElasticConnection.newBuilder().withIndexPrefix(indexPrefix).withConnectionParameters(scheme, host, port);
    final ElasticConnection connection;
    if (apiKeyId != null && apiSecretId != null) {
        connection = buildStep.withApiKeys(apiKeyId, apiSecretId).build();
    } else {
        connection = buildStep.build();
    }
    closer.register(connection);
    ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
    return new ElasticIndexEditorProvider(indexTracker, connection, new ExtractedTextCache(10 * FileUtils.ONE_MB, 100));
}
Also used : ExtractedTextCache(org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) ElasticConnection(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)

Example 3 with ElasticIndexEditorProvider

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

the class ElasticIndexerProvider method getIndexer.

@Override
@Nullable
public NodeStateIndexer getIndexer(@NotNull String type, @NotNull String indexPath, @NotNull NodeBuilder definition, @NotNull NodeState root, IndexingProgressReporter progressReporter) {
    if (!ElasticIndexDefinition.TYPE_ELASTICSEARCH.equals(definition.getString(TYPE_PROPERTY_NAME))) {
        return null;
    }
    ElasticIndexDefinition idxDefinition = (ElasticIndexDefinition) new ElasticIndexDefinition.Builder(connection.getIndexPrefix()).root(root).indexPath(indexPath).defn(definition.getNodeState()).reindex().build();
    FulltextIndexWriter<ElasticDocument> indexWriter = indexWriterFactory.newInstance(idxDefinition, definition, CommitInfo.EMPTY, true);
    FulltextBinaryTextExtractor textExtractor = new FulltextBinaryTextExtractor(textCache, idxDefinition, true);
    ElasticIndexTracker indexTracker = new ElasticIndexTracker(connection, new ElasticMetricHandler(StatisticsProvider.NOOP));
    ElasticIndexEditorProvider elasticIndexEditorProvider = new ElasticIndexEditorProvider(indexTracker, connection, null);
    return new ElasticIndexer(idxDefinition, textExtractor, definition, progressReporter, indexWriter, elasticIndexEditorProvider, indexHelper);
}
Also used : FulltextBinaryTextExtractor(org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor) ElasticDocument(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocument) ElasticIndexTracker(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) ElasticMetricHandler(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler) ElasticIndexEditorProvider(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider) ElasticIndexDefinition(org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition) Nullable(org.jetbrains.annotations.Nullable)

Example 4 with ElasticIndexEditorProvider

use of org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider 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 5 with ElasticIndexEditorProvider

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

Aggregations

ElasticIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)15 ExtractedTextCache (org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache)13 ElasticIndexTracker (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker)10 ElasticMetricHandler (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler)10 ElasticIndexProvider (org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider)10 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)9 OakRepositoryFixture (org.apache.jackrabbit.oak.fixture.OakRepositoryFixture)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 ElasticConnection (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection)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