Search in sources :

Example 1 with ElasticIndexTracker

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

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

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

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

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

Aggregations

ElasticIndexTracker (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker)10 ElasticMetricHandler (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler)10 ElasticIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)10 ExtractedTextCache (org.apache.jackrabbit.oak.plugins.index.search.ExtractedTextCache)9 OakRepositoryFixture (org.apache.jackrabbit.oak.fixture.OakRepositoryFixture)6 Jcr (org.apache.jackrabbit.oak.jcr.Jcr)6 ElasticIndexProvider (org.apache.jackrabbit.oak.plugins.index.elastic.query.ElasticIndexProvider)6 NodeTypeIndexProvider (org.apache.jackrabbit.oak.plugins.index.nodetype.NodeTypeIndexProvider)4 PropertyIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.property.PropertyIndexEditorProvider)4 ElasticGlobalInitializer (org.apache.jackrabbit.oak.benchmark.util.ElasticGlobalInitializer)3 ElasticConnection (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticConnection)3 LinkedHashMap (java.util.LinkedHashMap)1 ElasticIndexDefinition (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition)1 ElasticDocument (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocument)1 FulltextBinaryTextExtractor (org.apache.jackrabbit.oak.plugins.index.search.spi.binary.FulltextBinaryTextExtractor)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1 Nullable (org.jetbrains.annotations.Nullable)1