serhiy-bzhezytskyy opened a new pull request, #4640:
URL: https://github.com/apache/solr/pull/4640

   https://issues.apache.org/jira/browse/SOLR-17316
   
   SolrJ's response classes assume binary-parser types, so reading a response 
parsed by a non-binary parser (the JSON parser) throws ClassCastException. Two 
commits so the small safe fix can go in on its own if you'd rather.
   
   Commit 1 is the narrow fix: getStatus/getQTime cast to Integer, which CCEs 
when JSON gives Long. Widened via Number. That's it — resolves the getters the 
issue names.
   
   Commit 2 goes further. It's not just the header — getResults(), facets, 
grouping all break under JSON too, because the parser hands back raw Map/List 
where the code wants NamedList/SolrDocumentList. So there's a 
ResponseNormalizer that converts a parsed response to the canonical shape at 
the client boundary (no-op for binary/XML), gated by a new 
ResponseParser.producesCanonicalForm() so only the JSON map parser triggers it. 
Both transports covered, binary pays nothing. Plus the remaining Integer/Float 
casts widened.
   
   Heads up: commit 2 basically does what SOLR-3451 asked for in 2012, which 
was closed Won't Fix ("solr does not have a way to write a JSON response and 
read the same value"). Still true for json.nl=flat since it's lossy, but 
json.nl=map round-trips and the normalizer does the rest. So I'd treat commit 2 
as reopening that discussion — fine to split it out or take it to dev@ if you'd 
prefer, commit 1 stands alone either way.
   
   Tests: the normalizer + edge cases, binary/xml/json-map parity, the affected 
sections (grouping, facets, stats, spellcheck, highlighting, terms, 
moreLikeThis, analysis, Luke, schema), and an end-to-end JSON query on both the 
Jetty and JDK clients.


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to