jaykay12 commented on code in PR #5168:
URL: https://github.com/apache/solr/pull/5168#discussion_r4291748724
##########
solr/api/src/java/org/apache/solr/client/api/endpoint/ConfigApi.java:
##########
@@ -70,6 +70,25 @@ ConfigZnodeVersionResponse getZnodeVersion(
@Parameter(description = "Expected request-params znode version")
int expectedParamsVersion);
+ @GET
+ @Path("/requestHandler")
Review Comment:
let me know, if this should also be now plural in the new v2 conventions?
will update accordingly.
##########
solr/api/src/java/org/apache/solr/client/api/endpoint/ConfigApi.java:
##########
@@ -70,6 +70,25 @@ ConfigZnodeVersionResponse getZnodeVersion(
@Parameter(description = "Expected request-params znode version")
int expectedParamsVersion);
+ @GET
+ @Path("/requestHandler")
+ @StoreApiParameters
+ @Operation(
+ summary = "Fetch request handlers (including implicit handler)",
+ tags = {"config"})
+ ConfigInfoResponse getRequestHandler(
+ @QueryParam("componentName")
+ @Parameter(description = "Name of the specific request handler")
+ String component,
Review Comment:
this is the most restful we can get here.
we can't use PathParams here like we have used for /searchComponents &
/queryResponseWriters.
##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetConfig.java:
##########
@@ -129,13 +129,34 @@ public ConfigZnodeVersionResponse getZnodeVersion(
return response;
}
+ @Override
+ @PermissionName(CONFIG_READ_PERM)
+ public ConfigInfoResponse getRequestHandler(
+ String componentName, boolean expandParams, boolean meta) {
+ final var response = instantiateJerseyResponse(ConfigInfoResponse.class);
+
+ Map<String, Object> configMap = new LinkedHashMap<>();
+ configMap.put(
+ SolrRequestHandler.TYPE,
+ requestHandlersWithImplicits(solrConfigAsMap(), expandParams,
componentName));
+ if (componentName != null) {
+ filterByComponentName(
+ configMap, SolrRequestHandler.TYPE, componentName, meta,
solrQueryRequest);
+ }
+
+ response.config = jsonSafeCopy(configMap);
+ return response;
+ }
+
@Override
@PermissionName(CONFIG_READ_PERM)
public ConfigInfoResponse getConfigComponent(String component) {
final var response = instantiateJerseyResponse(ConfigInfoResponse.class);
- Map<String, Object> section = new LinkedHashMap<>();
- section.put(component,
solrConfigAsMap().get(toInternalComponentName(component)));
- response.config = jsonSafeCopy(section);
+
+ Map<String, Object> configMap = new LinkedHashMap<>();
+ configMap.put(component,
solrConfigAsMap().get(toInternalComponentName(component)));
+
+ response.config = jsonSafeCopy(configMap);
Review Comment:
variable renaming is done, section -> configMap.
let me know, if this needs to be reverted.
##########
solr/core/src/java/org/apache/solr/handler/SolrConfigHandler.java:
##########
@@ -245,79 +249,6 @@ private void handleGET() {
}
}
- private Map<String, Object> getConfigDetails(String componentType,
SolrQueryRequest req) {
- String componentName = componentType == null ? null :
req.getParams().get("componentName");
- boolean showParams = req.getParams().getBool("expandParams", false);
- Map<String, Object> map =
- Utils.convertToMap(this.req.getCore().getSolrConfig(), new
LinkedHashMap<>());
- if (componentType != null &&
!SolrRequestHandler.TYPE.equals(componentType)) return map;
-
- @SuppressWarnings({"unchecked"})
- Map<String, Object> reqHandlers =
- (Map<String, Object>)
- map.computeIfAbsent(SolrRequestHandler.TYPE, k -> new
LinkedHashMap<>());
- List<PluginInfo> plugins = this.req.getCore().getImplicitHandlers();
- for (PluginInfo plugin : plugins) {
- if (SolrRequestHandler.TYPE.equals(plugin.type)) {
- if (!reqHandlers.containsKey(plugin.name)) {
- reqHandlers.put(plugin.name, plugin);
- }
- }
- }
- if (!showParams) return map;
- for (Map.Entry<String, Object> e : reqHandlers.entrySet()) {
- if (componentName == null || e.getKey().equals(componentName)) {
- Map<String, Object> m = expandUseParams(req, e.getValue());
- e.setValue(m);
- }
- }
-
- return map;
- }
-
- @SuppressWarnings({"unchecked"})
- private Map<String, Object> expandUseParams(SolrQueryRequest req, Object
plugin) {
Review Comment:
this was used only in Get /config which was already migrated & with
/config/requestHandler also getting migrated, this is no longer needed in this
class. Can be cleaned up from here.
##########
solr/core/src/java/org/apache/solr/handler/admin/api/GetConfig.java:
##########
@@ -144,10 +165,11 @@ public ConfigInfoResponse getConfigComponent(String
component) {
public ConfigInfoResponse getConfigComponentByName(
String component, String componentName, boolean meta) {
final var response = instantiateJerseyResponse(ConfigInfoResponse.class);
- Map<String, Object> section = new LinkedHashMap<>();
- section.put(component,
solrConfigAsMap().get(toInternalComponentName(component)));
- filterByComponentName(section, component, componentName, meta,
solrQueryRequest);
- response.config = jsonSafeCopy(section);
+
+ Map<String, Object> configMap = new LinkedHashMap<>();
+ configMap.put(component,
solrConfigAsMap().get(toInternalComponentName(component)));
+ filterByComponentName(configMap, component, componentName, meta,
solrQueryRequest);
+ response.config = jsonSafeCopy(configMap);
Review Comment:
same, variable renaming is done here.
section -> configMap.
--
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]