Skip to content

SOLR-18332: Remove reliance on deprecated 'qt' param in a first batch of tests - #4699

Merged
gerlowskija merged 2 commits into
apache:mainfrom
gerlowskija:qt-removal-from-tests-pt1
Aug 6, 2026
Merged

SOLR-18332: Remove reliance on deprecated 'qt' param in a first batch of tests#4699
gerlowskija merged 2 commits into
apache:mainfrom
gerlowskija:qt-removal-from-tests-pt1

Conversation

@gerlowskija

Copy link
Copy Markdown
Contributor

Convert tests that set the 'qt' request parameter directly on a
SolrQuery/SolrParams object to instead select the request handler via
QueryRequest's path-based constructor or an explicit handler argument.

Involves minor method-overload changes to SolrTestCaseJ4 and
BaseDistributedSearchTestCase.

… of tests

Convert tests that set the 'qt' request parameter directly on a
SolrQuery/SolrParams object to instead select the request handler via
QueryRequest's path-based constructor or an explicit handler argument.

Involves minor method-overload changes to SolrTestCaseJ4 and
BaseDistributedSearchTestCase.

@dsmiley dsmiley left a comment

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.

thanks for continuing the crusade


@Override
protected QueryResponse queryRandomShard(ModifiableSolrParams params)
protected QueryResponse queryRandomShard(String requestHandler, ModifiableSolrParams params)

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.

maybe out of scope but it's a shame to see ModifiableSolrParams instead of simply SolrParams

Comment thread solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Outdated
Comment thread solr/core/src/test/org/apache/solr/handler/TestReplicationHandler.java Outdated
Comment thread solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Outdated
Comment thread solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleTests.java Outdated
@@ -699,10 +698,11 @@ public void testErrorHandling() throws Exception {
SolrClient client = getSolrClient();

SolrQuery query = new SolrQuery();

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.

SolrQuery should only be used for SearchHandler.

}
}

protected QueryResponse queryRandomShard(ModifiableSolrParams params)

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.

Please just refer to SolrParams here

* <p>WARNING: tests should generally not call this as it doesn't compare to the control client
*/
protected QueryResponse queryRandomShard(ModifiableSolrParams params)
protected QueryResponse queryRandomShard(String requestHandler, ModifiableSolrParams params)

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.

No ModifiableSolrParams please

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.

The ModifiableSolrParams usage pre-exists this PR; it's not something this PR introduces. For scope reasons I'm a little leery of bogging down the qt effort in other unrelated refactors unless you feel especially strongly?

(See my PR-level comment asking a similar question.)

try {
QueryResponse rsp1 = client.query(new ModifiableSolrParams(params));
QueryResponse rsp1 =
new QueryRequest(requestHandler, new ModifiableSolrParams(params))

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.

hmm; not sure why we copy

@gerlowskija

Copy link
Copy Markdown
Contributor Author

Hey @dsmiley - thanks for the review.

I agree with all your comments by and large, but have scope concerns.

Specifically: I'd love for all of our test API calls to use the correct 'SolrRequest' type (e.g. LukeRequest for /admin/luke, GSR for /analysis/field). But that's a slightly larger change than just dropping 'qt', and multiplied out across the hundreds of these SolrJ and test-helper usages (only a fraction of which are in this PR) it would definitely impact velocity.

So I wanted to ask: how strongly do you feel about fixing both things in the same sweep of the codebase? If you feel strongly I'll make slower progress but also address this sort of stuff. But if you don't, I'll stick pretty strictly to "just" ripping out qt as my initial pass here did.

@dsmiley

dsmiley commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

RE the proper request type -- not blocking. But for most of these spots, it's just changing the very same line you are already touching. I did similar work days ago -- I was modifying certain callers of QueryRequest to use the path. While I was at it, I also switched some to GSR as appropriate at the same call-site.

@gerlowskija

Copy link
Copy Markdown
Contributor Author

I've addressed a number of the "right SolrRequest/SolrResponse" places and it did end up being easy in some (but not all) cases.

The ModifiableSolrParams stuff I left untouched as that preexists this PR and would be a larger change.

@gerlowskija

Copy link
Copy Markdown
Contributor Author

Test and check pass locally fwiw

@epugh

epugh commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

I love it! Now go to the beach ;-)

@gerlowskija
gerlowskija merged commit 02d3cb4 into apache:main Aug 6, 2026
5 of 8 checks passed
@gerlowskija
gerlowskija deleted the qt-removal-from-tests-pt1 branch August 6, 2026 02:00
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.

3 participants