Skip to content

Refactor CLI StreamTool SolrClientCache usage#4513

Open
dsmiley wants to merge 2 commits into
apache:mainfrom
dsmiley:StreamToolRefactor
Open

Refactor CLI StreamTool SolrClientCache usage#4513
dsmiley wants to merge 2 commits into
apache:mainfrom
dsmiley:StreamToolRefactor

Conversation

@dsmiley

@dsmiley dsmiley commented Jun 9, 2026

Copy link
Copy Markdown
Contributor
  • don't call SolrClientCache.setBasicAuthCredentials, to be deprecated soon (primary motivation). Instead set this on the client passed into SCC.
  • insist on a StreamContext, even if "remote mode". Code was a bit of a mess, doing redundant things or not doing what it "should" do

* don't call SolrClientCache.setBasicAuthCredentials
* insist on a StreamContext, even if "remote mode"
@dsmiley dsmiley requested a review from epugh June 9, 2026 13:38
@dsmiley

dsmiley commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

Disclaimer: I haven't tested or even used it in a realistic way.

* @return the solrUrl in the format that Solr expects to see internally.
* @return a URL without any path, e.g. {@code http://localhost:8983}
*/
public static String normalizeSolrUrl(String solrUrl) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO these "normalize" methods are non-obvious since the URL normalization I'm used to seeing within Solr produce Solr URLs ending with "/solr". The javadoc here refers to what I'm used to as "legacy". Wow... am I a dinosaur or has v2 taken over? SolrJ didn't get the memo, I can tell you that.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a little bit dinosaur... But not a lot dinosaur... We've been trying to simpliy users lives so they don't have to think about /solr or /v2 or /api all the time, unless is critical. So, we normalize to the root version, and then whatever tool can append what it needs...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO URL utility methods should be centralized to URLUtil. And naming reconsidered. If this method produces URLs without any path, then this is an opportunity to very simply state that in the method name rather than ambiguous "normalization", (it once wasn't ambiguous but in our transition period, is ambiguous).

@epugh

epugh commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Is #4510 potentially overlapping with this work?

}
HttpJettySolrClient client = jettyClientBuilder.build();

// subclass so we can ensure our client is closed when the cache is closed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is some magic! If this isn't there, do we see errors?

}
return new PushBackStream(solrStream);
return new PushBackStream(
new SolrStream(solrUrl + "/solr/" + collection, params("qt", "/stream", "expr", expr)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel like this should be "/solr/" + collection + "/stream", params("expr",expr)... but that is a bigger change.

Signed-off-by: Eric Pugh <epugh@opensourceconnections.com>
@epugh epugh self-assigned this Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants