[ 
https://issues.apache.org/jira/browse/SOLR-17316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18096550#comment-18096550
 ] 

Serhiy Bzhezytskyy commented on SOLR-17316:
-------------------------------------------

PR: https://github.com/apache/solr/pull/4640

Two commits. First is the narrow fix for this issue — getStatus/getQTime cast 
to Integer and CCE'd under the JSON parser (which gives Long); widened via 
Number.

Second commit goes further: a ResponseNormalizer that converts a JSON-parsed 
response to the canonical NamedList/SolrDocumentList shape at the client 
boundary, so getResults(), facets, grouping etc. all work over JSON — not just 
the header getters. That effectively delivers what SOLR-3451 asked for in 2012 
(typed QueryResponse over JSON), which was closed Won't Fix because "solr does 
not have a way to write a JSON response and read the same value." Still true 
for json.nl=flat (lossy), but json.nl=map round-trips and the normalizer 
handles the rest. So I'd treat that second commit as reopening 3451 — happy to 
split it out or take it to dev@ if that's the better path. The first commit 
stands alone.

One broader question while you're looking: is a normalizer the right long-term 
fix for V1 search responses, or is the plan to eventually give QueryResponse 
typed V2/Jersey responses the way the admin APIs are going (SOLR-15734 etc.)? I 
couldn't find a JIRA tracking that for search — happy to file one if it's 
wanted, but wanted to check the direction first.

> SolrResponseBase getters should work with all ResponseParsers 
> --------------------------------------------------------------
>
>                 Key: SOLR-17316
>                 URL: https://issues.apache.org/jira/browse/SOLR-17316
>             Project: Solr
>          Issue Type: Bug
>          Components: SolrJ
>    Affects Versions: 9.6.1, 10.0
>            Reporter: Jason Gerlowski
>            Priority: Minor
>              Labels: pull-request-available
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> SolrJ's SolrResponseBase has several "getter" methods that give users a 
> syntactic sugar for accessing common response properties (such as the 
> response header's "status" field).  These methods are useful, but make 
> certain Java class/type assumptions that only hold for some of Solr's 
> ResponseParsers.
> For example, "SolrResponseBase.getResponseHeader" returns a NamedList - which 
> is correct when the default "BinaryResponseParser" is used, but will cause a 
> ClassCastException when used with other parsers (e.g. JsonMapResponseParser)
> We have a few options for how to remedy this:
> 1. Make these SolrResponseBase methods a little more flexible in the types 
> they return and the variety of types they can handle as they walk the 
> response NamedList
> 2. Try to align all ResponseParser implementations around using types 
> similarly.
> 3. If (1) and (2) are infeasible, we could at least add Javadocs to these 
> SolrResponseBase methods to indicate that they may throw CCE, and that 
> they're only guaranteed to work with the BinaryResponseParser.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to