epugh commented on code in PR #2197:
URL: https://github.com/apache/solr/pull/2197#discussion_r1486251420


##########
solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java:
##########
@@ -117,7 +117,7 @@ public class SearchHandler extends RequestHandlerBase
   private SolrCore core;
 
   protected List<String> getDefaultComponents() {
-    ArrayList<String> names = new ArrayList<>(8);
+    ArrayList<String> names = new ArrayList<>(9);

Review Comment:
   is there any way to get rid of this magic number?   This seems very error 
prone.....?



##########
solr/core/src/java/org/apache/solr/handler/component/SearchComponent.java:
##########
@@ -111,21 +109,16 @@ public void initializeMetrics(SolrMetricsContext 
parentContext, String scope) {
     this.solrMetricsContext = parentContext.getChildContext(this);
   }
 
-  public static final Map<String, Class<? extends SearchComponent>> 
standard_components;
-
-  static {
-    HashMap<String, Class<? extends SearchComponent>> map = new HashMap<>();
-    map.put(HighlightComponent.COMPONENT_NAME, HighlightComponent.class);
-    map.put(QueryComponent.COMPONENT_NAME, QueryComponent.class);
-    map.put(FacetComponent.COMPONENT_NAME, FacetComponent.class);
-    map.put(FacetModule.COMPONENT_NAME, FacetModule.class);
-    map.put(MoreLikeThisComponent.COMPONENT_NAME, MoreLikeThisComponent.class);
-    map.put(StatsComponent.COMPONENT_NAME, StatsComponent.class);
-    map.put(DebugComponent.COMPONENT_NAME, DebugComponent.class);
-    map.put(RealTimeGetComponent.COMPONENT_NAME, RealTimeGetComponent.class);
-    map.put(ExpandComponent.COMPONENT_NAME, ExpandComponent.class);
-    map.put(TermsComponent.COMPONENT_NAME, TermsComponent.class);
-
-    standard_components = Collections.unmodifiableMap(map);
-  }
+  public static final Map<String, Class<? extends SearchComponent>> 
standard_components =
+      Map.of(

Review Comment:
   kind of a nit pick, but the variable should be `standardComponents` ?    We 
really need more code quality checks for things like this globaly...



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to