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);
}
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;
}
Aggregations