adityamparikh opened a new pull request, #55:
URL: https://github.com/apache/solr-mcp/pull/55
## Summary
- Adds `JsonResponseParser`, a custom SolrJ `ResponseParser` that requests
`wt=json` and converts Solr's JSON response into the `NamedList` object tree
that SolrJ typed response classes expect internally
- Wires it into `SolrConfig` via `.withResponseParser(new
JsonResponseParser())`, replacing the default `BinaryResponseParser`
(`wt=javabin`)
- All existing behaviour is preserved — no changes to service layer code
## Design
The converter handles four structural differences between JSON and
JavaBin/XML:
| JSON shape | Converted to | Reason |
|---|---|---|
| JSON object | `SimpleOrderedMap` | Extends `NamedList` (satisfies
`QueryResponse`/`CollectionService` casts) and implements `Map<String,T>`
(satisfies `SchemaResponse`'s `(Map)` cast) |
| Object with `numFound` + `docs` | `SolrDocumentList` | `QueryResponse`
does `(SolrDocumentList) get("response")` |
| Array `["term", 5, "term2", 3]` | `SimpleOrderedMap` | Solr's
`json.nl=flat` default encodes facet counts as alternating string/non-string
pairs |
| Decimal numbers | `Float` | JavaBin encodes Solr floats as `FLOAT`;
`SchemaResponse` does `(Float) schema.get("version")` |
## Test plan
- [ ] `./gradlew build` — all 212 existing tests pass, including
`SchemaServiceIntegrationTest` and all other integration tests against a live
Solr container
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]