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

   https://issues.apache.org/jira/browse/SOLR-17044
   
   
   # Description
   
   SolrJ often needs to know whether a given request is for a v1 or v2 API, but 
doesn't have an easy way to do so.  The best it can do is one of two 
approximations: either check the path string for "____v2", or do an `instanceof 
V2Request` check.  Both of these are exceedingly brittle.
   
   # Solution
   
   This PR introduces a new request on the SolrRequest class: 
`getApiVersion()`.  It returns an ApiVersion enum value, which can either be 
"V1" or "V2".  The method has a default implementation on SolrRequest which 
returns the enum value "V1", overriding this on a number of subclasses that 
represent v2 requests (V2Request, various generated SolrJ classes, etc.)
   
   As usual with these sort of changes, `GenericSolrRequest` introduces some 
complications.  There's no great way to determine whether a given GSR 
represents a v1 or v2 API without resorting to the same brittle string 
inspection we're trying to avoid.  This PR solves this by assuming that 
'GenericSolrRequest' instances represent v1 API requests, and adds a trivial 
'GenericV2SolrRequest' class to represent v2 requests.  (Open to other ways of 
doing this if folks don't like this approach)
   
   # Tests
   
   Existing tests continue 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)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   


-- 
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-unsubscr...@solr.apache.org

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


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

Reply via email to