janhoy commented on code in PR #4943:
URL: https://github.com/apache/solr/pull/4943#discussion_r4097825886
##########
solr/api/src/java/org/apache/solr/client/api/endpoint/UpdateSchemaApi.java:
##########
@@ -112,25 +113,54 @@ SolrJerseyResponse addFieldType(
SolrJerseyResponse deleteFieldType(@PathParam("fieldTypeName") String
fieldTypeName)
throws Exception;
- // TODO Gah! Copyfields don't currently have names for us to create/delete
by name in an API like
- // /schema/copyfields/{copyFieldName}...figure out how to address this in a
way consistent with
- // all our other APIs. (In the meantime, the functionality is exposed
through the bulk API at
- // least.
- // @POST
- // @Path("/copyfields/{copyFieldName}")
- // @StoreApiParameters
- // @Operation(
- // summary = "Add a new copy-field with the specified name.",
- // tags = {"schema"})
- // SolrJerseyResponse addCopyField(@PathParam("copyFieldName") String
copyFieldName,
- // @RequestBody SchemaChangeOperation.AddCopyField requestBody) throws
Exception;
- //
- // @DELETE
- // @Path("/copyfields/{copyFieldName}")
- // @StoreApiParameters
- // @Operation(summary = "Remove the copy-field with the specified name.",
tags = {"schema"})
- // SolrJerseyResponse deleteCopyField(@PathParam("copyFieldName") String
copyFieldName) throws
- // Exception;
+ // Copy-field rules have no name of their own, so unlike the other schema
resources they are
+ // addressed by their source field. A single request therefore covers all
of the rules that
+ // share that source.
+ @PUT
+ @Path("/copyfields/{sourceField}")
+ @StoreApiParameters
+ @Operation(
+ summary =
+ "Set the copy-field rules for the specified source field. The given
destinations "
+ + "replace any rules that source already has.",
Review Comment:
A disconnect with the PUT (and POST) body format is that all destinations
share the same `maxChars`. For POST (additive), that can be defended by sending
multiple POST requests, for each group of destinations that share same
`maxChars`. But this won't work for PUT. An alternative is making the body an
array of objects:
```json
[
{"destinations": ["foo"], "maxChars": 100}
]
```
We could also keep the 1:1 plain object format, and we could use `dest`
instead of `destination` to stick with what v1 uses??
```json
[
{"dest": "foo", "maxChars": 100}
{"dest": "bar", "maxChars": 20}
]
```
--
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]