use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.OakSolrNodeStateConfiguration in project jackrabbit-oak by apache.
the class SolrIndexEditorProvider method getIndexEditor.
@Override
public Editor getIndexEditor(@Nonnull String type, @Nonnull NodeBuilder definition, @Nonnull NodeState root, @Nonnull IndexUpdateCallback callback) throws CommitFailedException {
SolrIndexEditor editor = null;
if (SolrQueryIndex.TYPE.equals(type)) {
try {
// if index definition contains a persisted configuration, use that
if (isPersistedConfiguration(definition)) {
NodeState nodeState = definition.getNodeState();
OakSolrConfiguration configuration = new OakSolrNodeStateConfiguration(nodeState);
SolrServerConfigurationProvider configurationProvider = new NodeStateSolrServerConfigurationProvider(definition.getChildNode("server").getNodeState());
SolrServer solrServer = new OakSolrServer(configurationProvider);
editor = getEditor(configuration, solrServer, callback);
} else {
// otherwise use the default configuration providers (e.g. defined via code or OSGi)
OakSolrConfiguration configuration = oakSolrConfigurationProvider.getConfiguration();
editor = getEditor(configuration, solrServerProvider.getIndexingSolrServer(), callback);
}
} catch (Exception e) {
log.warn("could not get Solr index editor from {}", definition.getNodeState(), e);
}
}
return editor;
}
Aggregations