Skip to content

Introduce GenericCollectionRequest #3423

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dsmiley
Copy link
Contributor

@dsmiley dsmiley commented Jul 9, 2025

and deprecate GenericSolrRequest.setRequiresCollection

https://issues.apache.org/jira/browse/SOLR-XXXXX TODO

Trying to emphasize the collection-ness in the constructor, and make other aspects mandatory (request type).

In a separate PR but debatably same JIRA, I'll change many usages of QueryRequest that should not be using such; should be generic. I have that shelved, waitng for this. That's how I got started down this path, actually.

and deprecate GenericSolrRequest.setRequiresCollection
new GenericSolrRequest(
SolrRequest.METHOD.GET,
"/schema/uniquekey",
SolrParams.of("collection", coll))
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

SolrRequest<SimpleSolrResponse> ur =
new GenericSolrRequest(METHOD.GET, "/get", params).setRequiresCollection(true);
var ur =
new GenericCollectionRequest(METHOD.GET, "/get", SolrRequest.SolrRequestType.ADMIN, params);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

shouldn't be in this PR; I'll remove

.setRequiresCollection(true));
new GenericCollectionRequest(
SolrRequest.METHOD.GET,
"/tasks/list",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

client.request(req, testCollection);
+ "{\"name\":\"film_vector\",\"type\":\"knn_vector_10\",\"indexed\":true,\"stored\":true}]}")
.getBytes(StandardCharsets.UTF_8),
XMLResponseWriter.CONTENT_TYPE_XML_UTF8),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

wrong; isn't XML

*/
@Deprecated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Aren't we attempting over time to get away fro the use of GenericSolrRequest anyway?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe but that's a long way out.

import org.apache.solr.common.util.NamedList;

/**
* A generic request for sending to a Solr collection or core.
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems a little sad that we still have the "collection or core" concept. I liked reading over the code, and the explicitness of the collection name being required. I also liked that the explicit type of request with the ADMIN was being added.

@dsmiley
Copy link
Contributor Author

dsmiley commented Jul 9, 2025

Not sure if this PR should refrain from changing RequestType or POST/GET for that matter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants