Search in sources :

Example 1 with NodeStateSolrServerConfigurationProvider

use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServerConfigurationProvider 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;
}
Also used : NodeStateSolrServerConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServerConfigurationProvider) NodeState(org.apache.jackrabbit.oak.spi.state.NodeState) NodeStateSolrServerConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServerConfigurationProvider) SolrServerConfigurationProvider(org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider) OakSolrServer(org.apache.jackrabbit.oak.plugins.index.solr.server.OakSolrServer) OakSolrConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration) OakSolrNodeStateConfiguration(org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.OakSolrNodeStateConfiguration) SolrServer(org.apache.solr.client.solrj.SolrServer) OakSolrServer(org.apache.jackrabbit.oak.plugins.index.solr.server.OakSolrServer) CommitFailedException(org.apache.jackrabbit.oak.api.CommitFailedException)

Aggregations

CommitFailedException (org.apache.jackrabbit.oak.api.CommitFailedException)1 OakSolrConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.OakSolrConfiguration)1 SolrServerConfigurationProvider (org.apache.jackrabbit.oak.plugins.index.solr.configuration.SolrServerConfigurationProvider)1 NodeStateSolrServerConfigurationProvider (org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServerConfigurationProvider)1 OakSolrNodeStateConfiguration (org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.OakSolrNodeStateConfiguration)1 OakSolrServer (org.apache.jackrabbit.oak.plugins.index.solr.server.OakSolrServer)1 NodeState (org.apache.jackrabbit.oak.spi.state.NodeState)1 SolrServer (org.apache.solr.client.solrj.SolrServer)1