dsmiley commented on code in PR #4640: URL: https://github.com/apache/solr/pull/4640#discussion_r3997900965
########## changelog/unreleased/SOLR-17316-response-parsers.yml: ########## @@ -0,0 +1,11 @@ +# See https://github.com/apache/solr/blob/main/dev-docs/changelog.adoc + +title: > + SolrJ's QueryResponse and other response objects can now read a JSON response, via the new + `CanonicalJsonResponseParser`; previously their accessors could throw ClassCastException. Review Comment: ```suggestion `CanonicalJsonResponseParser`.. ``` ########## solr/solrj/src/java/org/apache/solr/client/solrj/response/ResponseParser.java: ########## @@ -67,4 +82,19 @@ public abstract NamedList<Object> processResponse(InputStream body, String encod * @return the MIME types that this parser is capable of parsing. Never null. */ public abstract Set<String> getContentTypes(); + + /** + * Parses the response and returns it in the canonical shape the SolrJ response classes expect: a + * {@link NamedList} tree with {@link org.apache.solr.common.SolrDocumentList} for document + * sections. + * + * <p>Most parsers produce that shape directly and inherit this method unchanged. A parser whose + * natural output is a raw structure of {@code Map}s and {@code List}s — such as the JSON map + * parser — overrides it to convert, so that the conversion is the parser's own responsibility + * rather than something a client has to know to apply. + */ + public NamedList<Object> processCanonicalResponse(InputStream body, String encoding) Review Comment: This no longer needs to exist; right? Most Response Parsers are "canonical" by definition; the "JsonMap" one is not. ########## solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleJsonMapTest.java: ########## Review Comment: no longer named suitably. Just ditch the "Map" part IMO. -- 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]
