You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "gerlowskija (via GitHub)" <gi...@apache.org> on 2026/08/22 20:07:23 UTC

[PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

gerlowskija opened a new pull request, #4799:
URL: https://github.com/apache/solr/pull/4799

   https://issues.apache.org/jira/browse/SOLR-XXXXX
   
   # Description
   
   SOLR-18332 aims to reduce the usages of "qt" across our codebase.  Its usage complicates our code (by making the path of an HTTP "untrustworthy" for determining what code an API call actually triggers) and complicates security.
   
   One place where "QT" is very commonly used is in Solr's streaming expressions code.  Much of this is attributable to the SolrStream class and its cousins, which send HTTP requests but don't offer any way for callers to specify the HTTP path (without smuggling a "QT" parameter into the SolrParams object they consume).
   
   # Solution
   
   This PR resolves this problem by adding two new constructors to SolrStream that take in an explicit "path" parameter, and then replacing many QT usage sites with usage of the new, path-aware, constructor.
   
   In the process we also shift some of the SolrStream usage away from using string-concatenation and "coreUrls", in favor of explicit (and separate) base URL and core-name parameters.  
   
   # Tests
   
   This code is a refactor and doesn't modify any behavior or introduce any truly "new" code.  So validation consists of existing tests (particular streaming-related ones) continuing to pass.
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request title.
   - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended, not available for branches on forks living under an organisation)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3844065024


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {

Review Comment:
   Just looking at the types, it's fundamentally ambiguous.  The call-sites in Java don't dispatch by name, it dispatches by type so as a reader/reviewer we only hope that the arguments match the intent of the method's docs & var names.  
   
   It would placate me to mark this method `@VisibleForTesting`.  If that works for you, this is what I most prefer.
   
   My proposal collectionOrPath would provide a way for it to work both ways -- both would be valid.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3843875105


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -63,23 +65,57 @@ public class SolrStream extends TupleStream {
   private boolean distrib = true;
   private String user;
   private String password;
-  private String core;
 
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
-  public SolrStream(String baseUrl, SolrParams params) {
-    this.baseUrl = baseUrl;
+  public SolrStream(String collectionOrCoreUrl, SolrParams params) {
+    this.baseUrl = collectionOrCoreUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String collectionOrCoreUrl, String path, SolrParams params) {
+    this(collectionOrCoreUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {
+    this(baseUrl, core, null, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   * @param path the request handler path to query (e.g. "/export"). If not provided (i.e. {@code
+   *     null}), the handler is instead resolved from a "qt" param embedded in {@code params}, or

Review Comment:
   does this suggest we still support `qt`?



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3844079841


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -64,34 +65,33 @@ public class SolrStream extends TupleStream {
   private boolean distrib = true;
   private String user;
   private String password;
-  private String core;
 
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
   // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
   // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
    *     "http://host:8983/solr/myCore".
    * @param params query-parameters sent with the streaming request
    */
-  public SolrStream(String baseUrl, SolrParams params) {
-    this.baseUrl = baseUrl;
+  public SolrStream(String collectionOrCoreUrl, SolrParams params) {
+    this.baseUrl = collectionOrCoreUrl;

Review Comment:
   can we further check that there are exactly 2  '/' further validation?



##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -106,15 +106,16 @@ public SolrStream(String baseUrl, SolrParams params, String core) {
   /**
    * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
    * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
-   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
-   *     "/select".
+   * @param path the request handler path to query (e.g. "/export"). If not provided (i.e. {@code
+   *     null}), the handler is instead resolved from a "qt" param embedded in {@code params}, or
+   *     defaults to "/select" if no such param is present.
    * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, String core, String path, SolrParams params) {
     this.baseUrl = baseUrl;
     this.core = core;

Review Comment:
   IMO ideally we would do a null check on core and if null then split it out of baseUrl



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on PR #4799:
URL: https://github.com/apache/solr/pull/4799#issuecomment-5395739713

   (Tests and check pass, as a reminder to myself.)


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on PR #4799:
URL: https://github.com/apache/solr/pull/4799#issuecomment-5394639493

   Addressed many of the review comments, but there's still one or two left "unresolved" where I could use more info.  Thanks for the review @dsmiley 


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3842736711


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {

Review Comment:
   Can you give a little more detail on the ambiguity you're worried about?
   
   It seems to me that tweaking the second parameter to be able to take either a coreName or a path would make the method **more** ambiguous, not less.  So I must be misunderstanding what you mean by "ambiguous"... 



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3855555735


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -64,34 +65,33 @@ public class SolrStream extends TupleStream {
   private boolean distrib = true;
   private String user;
   private String password;
-  private String core;
 
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
   // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
   // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
    *     "http://host:8983/solr/myCore".
    * @param params query-parameters sent with the streaming request
    */
-  public SolrStream(String baseUrl, SolrParams params) {
-    this.baseUrl = baseUrl;
+  public SolrStream(String collectionOrCoreUrl, SolrParams params) {
+    this.baseUrl = collectionOrCoreUrl;

Review Comment:
   I'd rather not:
   
   1. Folks sometimes deploy Solr behind a proxy at a path of their choosing.  Since SolrStream is a client-side class, I think we need to be flexible to accommodate that.
   2. It'd bake in v1 API specific assumptions.
   3. I'm hoping to get to SOLR-17995 pretty quickly and deprecate/remove this ctor altogether.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on PR #4799:
URL: https://github.com/apache/solr/pull/4799#issuecomment-5382356911

   I still want to review this a bit more thoroughly - not sure it's ready for primetime yet


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3837133597


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {
+    this(baseUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {

Review Comment:
   I strongly think ordering matters.  core has no business being after params.



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -893,11 +854,8 @@ public void testIndirectDeleteStreamInsufficientCredentials() throws Exception {
       final SolrStream solrStream =
           new SolrStream(
               solrUrl + "/" + path,

Review Comment:
   yuck; the "path" above is actually the collection name!  Can you please rename the var and use as a separate param



##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form

Review Comment:
   baseUrl is a poor name; it should be collectionSolrUrl perhaps.  It's not "base"; that would be to Solr itself.



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -857,8 +816,10 @@ public void testIndirectDeleteStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_X, // NOTE: X route
-              params("qt", "/stream", "expr", expr));
+              solrUrl,
+              COLLECTION_X,
+              "/stream", // NOTE: X route

Review Comment:
   misplaced comment (please handle the rest)



##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {
+    this(baseUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {
+    this(baseUrl, core, null, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String core, String path, SolrParams params) {
+    this.baseUrl = baseUrl;
     this.core = core;
+    this.params = params;
+    this.path = path != null ? path : "/select";

Review Comment:
   gonna be nit-picky here and ask you to move the path initialization above params.  And likewise move the field definition up likewise.



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -398,8 +383,9 @@ public void testIndirectUpdateStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_Y, // NOTE: Y route
-              params("qt", "/stream", "expr", expr));
+              solrUrl + "/" + COLLECTION_Y,
+              "/stream", // NOTE: Y route

Review Comment:
   the "y route" comment was intended to be on the collection



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -833,8 +791,9 @@ public void testIndirectDeleteStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_Y, // NOTE: Y route
-              params("qt", "/stream", "expr", expr));
+              solrUrl + "/" + COLLECTION_Y,
+              "/stream", // NOTE: Y route

Review Comment:
   misplaced comment



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -398,8 +383,9 @@ public void testIndirectUpdateStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_Y, // NOTE: Y route
-              params("qt", "/stream", "expr", expr));
+              solrUrl + "/" + COLLECTION_Y,

Review Comment:
   I think we can provide the collection as a separate param



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -833,8 +791,9 @@ public void testIndirectDeleteStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_Y, // NOTE: Y route
-              params("qt", "/stream", "expr", expr));
+              solrUrl + "/" + COLLECTION_Y,

Review Comment:
   I think we can provide the collection as a separate param



##########
solr/solrj-streaming/src/test/org/apache/solr/client/solrj/io/stream/CloudAuthStreamTest.java:
##########
@@ -418,8 +404,10 @@ public void testIndirectUpdateStream() throws Exception {
 
       final SolrStream solrStream =
           new SolrStream(
-              solrUrl + "/" + COLLECTION_X, // NOTE: X route
-              params("qt", "/stream", "expr", expr));
+              solrUrl,
+              COLLECTION_X,
+              "/stream", // NOTE: X route

Review Comment:
   misplaced comment; put on collection



##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {

Review Comment:
   This method signature is extremely ambiguous.  Maybe "path" should actually be "collectionOrPath" determined by whether it starts with a forward slash?



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on PR #4799:
URL: https://github.com/apache/solr/pull/4799#issuecomment-5382953705

   Great work here Jason; clearly better!


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3842753602


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {
+    this(baseUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {

Review Comment:
   I agree.  My ideal ordering is down in L113 below: URL then core then path then params.
   
   This constructor actually pre-exists this PR (despite the diff marking it all as 'green').  So if we wanted to get rid of it, it'd need to be deprecated in 10x first.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "dsmiley (via GitHub)" <gi...@apache.org>.
dsmiley commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3844116667


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -63,23 +65,57 @@ public class SolrStream extends TupleStream {
   private boolean distrib = true;
   private String user;
   private String password;
-  private String core;
 
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
-  public SolrStream(String baseUrl, SolrParams params) {
-    this.baseUrl = baseUrl;
+  public SolrStream(String collectionOrCoreUrl, SolrParams params) {
+    this.baseUrl = collectionOrCoreUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param collectionOrCoreUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String collectionOrCoreUrl, String path, SolrParams params) {
+    this(collectionOrCoreUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {
+    this(baseUrl, core, null, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   * @param path the request handler path to query (e.g. "/export"). If not provided (i.e. {@code
+   *     null}), the handler is instead resolved from a "qt" param embedded in {@code params}, or

Review Comment:
   Indeed; Jason isn't removing support for QT.  He's avoiding needless usage of it.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3843890873


##########
solr/core/src/test/org/apache/solr/handler/admin/DaemonStreamApiTest.java:
##########
@@ -69,7 +69,7 @@ public void setUp() throws Exception {
     super.setUp();
     cluster = new MiniSolrCloudCluster(1, createTempDir(), JettyConfig.builder().build());
 
-    url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString() + "/" + CHECKPOINT_COLL;
+    url = cluster.getJettySolrRunners().get(0).getBaseUrl().toString();

Review Comment:
   I like, I think I see you moved `CHECKPOINT_COLL` down to the specific place it's needed!



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3842753602


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -68,18 +69,52 @@ public class SolrStream extends TupleStream {
   private transient SolrClientCache clientCache;
   private transient boolean doCloseCache;
 
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
   /**
-   * @param baseUrl Base URL of the stream.
-   * @param params Map&lt;String, String&gt; of parameters
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, SolrParams params) {
     this.baseUrl = baseUrl;
     this.params = params;
   }
 
-  SolrStream(String baseUrl, SolrParams params, String core) {
-    this(baseUrl, params);
+  // TODO SOLR-17995 proposes that we should deprecate this constructor in favor of one of the other
+  // constructors that requires users to provide the core as an explicit parameter
+  /**
+   * @param baseUrl URL of the Solr core or collection to query, typically of the form
+   *     "http://host:8983/solr/myCore".
+   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
+   *     "/select".
+   * @param params query-parameters sent with the streaming request
+   */
+  public SolrStream(String baseUrl, String path, SolrParams params) {
+    this(baseUrl, null, path, params);
+  }
+
+  /**
+   * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
+   * @param params query-parameters sent with the streaming request
+   * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
+   */
+  public SolrStream(String baseUrl, SolrParams params, String core) {

Review Comment:
   I agree.  My ideal ordering is down in L113 below: URL then core then path then params.
   
   This constructor actually pre-exists this PR (despite the diff marking it all as 'green') So whether I like it or not it'd be a breaking change to remove.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija merged PR #4799:
URL: https://github.com/apache/solr/pull/4799


-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org


Re: [PR] SOLR-18332: Remove avoidable QT-usage in SolrStream construction [solr]

Posted by "gerlowskija (via GitHub)" <gi...@apache.org>.
gerlowskija commented on code in PR #4799:
URL: https://github.com/apache/solr/pull/4799#discussion_r3855694024


##########
solr/solrj-streaming/src/java/org/apache/solr/client/solrj/io/stream/SolrStream.java:
##########
@@ -106,15 +106,16 @@ public SolrStream(String baseUrl, SolrParams params, String core) {
   /**
    * @param baseUrl the Solr node's "base" URL (i.e. no core or collection in the path
    * @param core the name of the collection or core to query; must be hosted at {@code baseUrl}
-   * @param path the request handler path to query (e.g. "/export"). If not provided, defaults to
-   *     "/select".
+   * @param path the request handler path to query (e.g. "/export"). If not provided (i.e. {@code
+   *     null}), the handler is instead resolved from a "qt" param embedded in {@code params}, or
+   *     defaults to "/select" if no such param is present.
    * @param params query-parameters sent with the streaming request
    */
   public SolrStream(String baseUrl, String core, String path, SolrParams params) {
     this.baseUrl = baseUrl;
     this.core = core;

Review Comment:
   I'd rather not unless you feel strongly?  I've seen that sort of string-manipulation logic be creaky/inflexible in other places in the past.  It's one of the reasons we're trying to move away from coreUrls.
   
   You can think of all sorts of edge cases, e.g. what if a user is trying to use SolrStream with a SolrClient that has a "default collection" set?
   
   Also as I mentioned elsewhere, I'm planning to tackle SOLR-17995 in pretty short order, so hopefully this'll be a moot point quite soon.



-- 
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: issues-unsubscribe@solr.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org