dsmiley commented on code in PR #3423:
URL: https://github.com/apache/solr/pull/3423#discussion_r2193943765


##########
solr/solrj/src/java/org/apache/solr/client/solrj/request/GenericSolrRequest.java:
##########
@@ -85,7 +85,9 @@ public GenericSolrRequest(METHOD m, String path, 
SolrRequestType requestType, So
    * 'false' otherwise.
    *
    * @param requiresCollection true if a default collection should be used, 
false otherwise.
+   * @deprecated use {@link GenericCollectionRequest} instead
    */
+  @Deprecated

Review Comment:
   perhaps controversial as you added this @gerlowskija but the opinionated 
stance I'm taking is to build this into the type, not be an optional method to 
call or forget to call



##########
solr/core/src/test/org/apache/solr/util/TestCborDataFormat.java:
##########
@@ -145,51 +145,57 @@ private byte[] runQuery(String testCollection, 
CloudSolrClient client, String wt
 
   private void modifySchema(String testCollection, CloudSolrClient client)
       throws SolrServerException, IOException {
-    GenericSolrRequest req =
-        new GenericSolrRequest(SolrRequest.METHOD.POST, "/schema")
-            .setRequiresCollection(true)
-            .setContentWriter(
-                new RequestWriter.StringPayloadContentWriter(
-                    "{\n"
+    client.request(
+        new GenericCollectionRequest(
+                SolrRequest.METHOD.POST,
+                "/schema",
+                SolrRequest.SolrRequestType.ADMIN,
+                SolrParams.of())
+            .withContent(
+                ("{\n"
                         + "\"add-field-type\" : {"
                         + 
"\"name\":\"knn_vector_10\",\"class\":\"solr.DenseVectorField\",\"vectorDimension\":10,\"similarityFunction\":\"cosine\",\"knnAlgorithm\":\"hnsw\"},\n"
                         + "\"add-field\" : ["
                         + 
"{\"name\":\"name\",\"type\":\"sortabletext\",\"multiValued\":false,\"stored\":true},\n"
                         + 
"{\"name\":\"initial_release_date\",\"type\":\"string\",\"stored\":true},\n"
                         + 
"{\"name\":\"directed_by\",\"type\":\"string\",\"multiValued\":true,\"stored\":true},\n"
                         + 
"{\"name\":\"genre\",\"type\":\"string\",\"multiValued\":true,\"stored\":true},\n"
-                        + 
"{\"name\":\"film_vector\",\"type\":\"knn_vector_10\",\"indexed\":true,\"stored\":true}]}",
-                    XMLResponseWriter.CONTENT_TYPE_XML_UTF8));
-
-    client.request(req, testCollection);
+                        + 
"{\"name\":\"film_vector\",\"type\":\"knn_vector_10\",\"indexed\":true,\"stored\":true}]}")
+                    .getBytes(StandardCharsets.UTF_8),
+                XMLResponseWriter.CONTENT_TYPE_XML_UTF8),

Review Comment:
   wrong; isn't XML



##########
solr/core/src/test/org/apache/solr/search/TestTaskManagement.java:
##########
@@ -185,8 +186,11 @@ private NamedList<String> listTasks() throws 
SolrServerException, IOException {
         cluster
             .getSolrClient(COLLECTION_NAME)
             .request(
-                new GenericSolrRequest(SolrRequest.METHOD.GET, "/tasks/list")
-                    .setRequiresCollection(true));
+                new GenericCollectionRequest(
+                    SolrRequest.METHOD.GET,
+                    "/tasks/list",

Review Comment:
   it was a little eye-opening to see we have a handler that doesn't "look" 
like an admin handler but is one



##########
solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java:
##########
@@ -681,8 +680,8 @@ private UpdateCommand 
fetchFullUpdateFromLeader(AddUpdateCommand inplaceAdd, lon
     params.set(DISTRIB, false);
     params.set("getInputDocument", id);
     params.set("onlyIfActive", true);
-    SolrRequest<SimpleSolrResponse> ur =
-        new GenericSolrRequest(METHOD.GET, "/get", 
params).setRequiresCollection(true);
+    var ur =
+        new GenericCollectionRequest(METHOD.GET, "/get", 
SolrRequest.SolrRequestType.ADMIN, params);

Review Comment:
   making the request type mandatory; force you to think about it.  RTG is used 
for internal purposes; maybe QUERY would get throttled?  Or maybe not; I recall 
the rate limiter would ignore internal requests.  LBSolrClient should retry a 
QUERY but not ADMIN; maybe this should be QUERY.



##########
solr/core/src/test/org/apache/solr/cloud/MultiThreadedOCPTest.java:
##########


Review Comment:
   shouldn't be in this PR; I'll remove



##########
solr/core/src/java/org/apache/solr/cli/ExportTool.java:
##########
@@ -253,11 +253,12 @@ void fetchUniqueKey() throws SolrServerException, 
IOException {
               .build();
       NamedList<Object> response =
           solrClient.request(
-              new GenericSolrRequest(
-                      SolrRequest.METHOD.GET,
-                      "/schema/uniquekey",
-                      SolrParams.of("collection", coll))

Review Comment:
   I don't love that collection param; moved to the request path



-- 
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