diff --git a/src/java/org/apache/solr/core/SolrCore.java b/src/java/org/apache/solr/core/SolrCore.java index b46bf8b242d..b42f1e6497f 100644 --- a/src/java/org/apache/solr/core/SolrCore.java +++ b/src/java/org/apache/solr/core/SolrCore.java @@ -493,16 +493,31 @@ public final class SolrCore { private static Map loadSearchComponents( SolrConfig config ) { Map components = new HashMap(); - components.put( QueryComponent.COMPONENT_NAME, new QueryComponent() ); - components.put( FacetComponent.COMPONENT_NAME, new FacetComponent() ); - components.put( MoreLikeThisComponent.COMPONENT_NAME, new MoreLikeThisComponent() ); - components.put( HighlightComponent.COMPONENT_NAME, new HighlightComponent() ); - components.put( DebugComponent.COMPONENT_NAME, new DebugComponent() ); String xpath = "searchComponent"; NamedListPluginLoader loader = new NamedListPluginLoader( xpath, components ); loader.load( config.getResourceLoader(), (NodeList)config.evaluate( xpath, XPathConstants.NODESET ) ); + final Map> standardcomponents + = new HashMap>(); + standardcomponents.put( QueryComponent.COMPONENT_NAME, QueryComponent.class ); + standardcomponents.put( FacetComponent.COMPONENT_NAME, FacetComponent.class ); + standardcomponents.put( MoreLikeThisComponent.COMPONENT_NAME, MoreLikeThisComponent.class ); + standardcomponents.put( HighlightComponent.COMPONENT_NAME, HighlightComponent.class ); + standardcomponents.put( DebugComponent.COMPONENT_NAME, DebugComponent.class ); + for( Map.Entry> entry : standardcomponents.entrySet() ) { + if( components.get( entry.getKey() ) == null ) { + try { + SearchComponent comp = entry.getValue().newInstance(); + comp.init( null ); // default components initialized with nothing + components.put( entry.getKey(), comp ); + } + catch (Exception e) { + SolrConfig.severeErrors.add( e ); + SolrException.logOnce(log,null,e); + } + } + } return components; }