Search in sources :

Example 1 with ElasticDocument

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

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

the class ElasticIndexer method index.

@Override
public boolean index(NodeStateEntry entry) throws IOException, CommitFailedException {
    if (getFilterResult(entry.getPath()) != PathFilter.Result.INCLUDE) {
        return false;
    }
    IndexDefinition.IndexingRule indexingRule = definition.getApplicableIndexingRule(entry.getNodeState());
    if (indexingRule == null) {
        return false;
    }
    ElasticDocumentMaker maker = newDocumentMaker(indexingRule, entry.getPath());
    ElasticDocument doc = maker.makeDocument(entry.getNodeState());
    if (doc != null) {
        writeToIndex(doc, entry.getPath());
        progressReporter.indexUpdate(definition.getIndexPath());
        return true;
    }
    return false;
}
Also used : IndexDefinition(org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition) ElasticDocument(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocument) ElasticDocumentMaker(org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocumentMaker)

Aggregations

ElasticDocument (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocument)2 ElasticIndexDefinition (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexDefinition)1 ElasticIndexTracker (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticIndexTracker)1 ElasticMetricHandler (org.apache.jackrabbit.oak.plugins.index.elastic.ElasticMetricHandler)1 ElasticDocumentMaker (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticDocumentMaker)1 ElasticIndexEditorProvider (org.apache.jackrabbit.oak.plugins.index.elastic.index.ElasticIndexEditorProvider)1 IndexDefinition (org.apache.jackrabbit.oak.plugins.index.search.IndexDefinition)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