feat(config): switch Solr wire format from JavaBin to JSON#55
Open
adityamparikh wants to merge 6 commits intoapache:mainfrom
Open
feat(config): switch Solr wire format from JavaBin to JSON#55adityamparikh wants to merge 6 commits intoapache:mainfrom
adityamparikh wants to merge 6 commits intoapache:mainfrom
Conversation
Replace the default BinaryResponseParser (wt=javabin) with a custom JsonResponseParser (wt=json) for future-proofing and improved debuggability. The JsonResponseParser converts Solr's JSON response envelope into the NamedList<Object> tree that SolrJ typed response classes expect: - JSON objects → SimpleOrderedMap (extends NamedList, implements Map, satisfying both QueryResponse's NamedList casts and SchemaResponse's Map cast) - JSON objects with numFound+docs → SolrDocumentList - Flat alternating arrays [String, non-String, ...] → SimpleOrderedMap (Solr's json.nl=flat encoding for facet counts) - All other arrays → List - Decimal numbers → Float (matching JavaBin's float type, required by SchemaResponse's (Float) version cast) - Small integers → Integer, large integers → Long Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Extract JsonResponseParser instantiation into a dedicated @bean method so it can be injected as a dependency into solrClient(), making the wiring explicit and enabling overriding in tests. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Replace the static new ObjectMapper() with Spring's auto-configured ObjectMapper bean injected via constructor. Use MediaType.APPLICATION_JSON_VALUE for the content type constant instead of a raw string literal. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
…'s ObjectMapper Extract URL normalization tests from SolrConfigTest into a dedicated SolrConfigUrlNormalizationTest annotated with @jsontest, so Spring's auto-configured ObjectMapper is injected rather than using new ObjectMapper(). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
This was referenced Mar 8, 2026
adityamparikh
added a commit
to adityamparikh/solr-mcp
that referenced
this pull request
Mar 8, 2026
…o sb4 Incorporates: - feat(config): switch Solr wire format from JavaBin to JSON (apache#55) - fix(collection): catch RuntimeException from removed /admin/mbeans in Solr 10 (apache#59) - feat(ci): add Solr 9.10 and 10 compatibility testing (apache#59) - feat(deps): upgrade solr-solrj from 9.9.0 to 10.0.0 (apache#58) Adapted JsonResponseParser for Jackson 3 (tools.jackson.databind). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Replace unused catch variable with underscore unnamed pattern (S7467) in SolrConfigUrlNormalizationTest - Java 25 feature. Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com> Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: adityamparikh <aditya.m.parikh@gmail.com>
Signed-off-by: Aditya Parikh <adityamparikh@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
JsonResponseParser, a custom SolrJResponseParserthat requestswt=jsonand converts Solr's JSON response into theNamedListobject tree that SolrJ typed response classes expect internallySolrConfigvia.withResponseParser(new JsonResponseParser()), replacing the defaultBinaryResponseParser(wt=javabin)Design
The converter handles four structural differences between JSON and JavaBin/XML:
SimpleOrderedMapNamedList(satisfiesQueryResponse/CollectionServicecasts) and implementsMap<String,T>(satisfiesSchemaResponse's(Map)cast)numFound+docsSolrDocumentListQueryResponsedoes(SolrDocumentList) get("response")["term", 5, "term2", 3]SimpleOrderedMapjson.nl=flatdefault encodes facet counts as alternating string/non-string pairsFloatFLOAT;SchemaResponsedoes(Float) schema.get("version")Test plan
./gradlew build— all 212 existing tests pass, includingSchemaServiceIntegrationTestand all other integration tests against a live Solr container🤖 Generated with Claude Code