adityamparikh opened a new pull request, #292:
URL: https://github.com/apache/solr-mcp/pull/292

   ## Summary
   
   `get-schema` and `solr://{collection}/schema` now return a 
`CollectionSchema` record instead of SolrJ's `SchemaRepresentation`.
   
   ```diff
    getSchema(collection)
   -  schemaRequest.process(solrClient, collection)   # SolrJ parses into 
SchemaRepresentation
   -    .getSchemaRepresentation()                    #   FieldTypeDefinition: 
{attributes:{name,class,...},
   -                                                  #   analyzer:null, 
multiTermAnalyzer:null, similarity:null}
   +  solrClient.request(new SchemaRequest(), collection)       # Schema API 
JSON, objects as SimpleOrderedMap (a Map)
   +  objectMapper.convertValue(response.get("schema"), CollectionSchema.class)
   ```
   
   The records type what clients read and keep everything else:
   
   ```text
   CollectionSchema   name, version, uniqueKey, fieldTypes, fields, 
dynamicFields, copyFields, other
     Field            name, type, indexed, stored, docValues, multiValued, 
required, other
     FieldType        name, className ("class"), analyzer, indexAnalyzer, 
queryAnalyzer, multiTermAnalyzer, other
     Analyzer         charFilters, tokenizer, filters, other
     CopyField        source, dest, maxChars, other
   ```
   
   `other` is a catch-all marked `@JsonAnySetter @JsonAnyGetter`. Jackson 
collects each property the record does not declare into it 
(`positionIncrementGap`, `vectorDimension`, `useDocValuesAsStored`, 
`similarity`, …) and writes it back out at the same level, so what a client 
receives is the Schema API's own JSON, and a property a later Solr version adds 
is passed on instead of dropped.
   
   The new records are registered in `SolrNativeHints.MCP_TOOL_RECORDS`; the 
`SchemaRepresentation` hint is removed because nothing serializes it any more.
   
   ## Evidence
   
   - **Before:** `get-schema` on `_default` returns 32,169 bytes: each field 
type wrapped as `{"attributes":{"name":…,"class":…}, "analyzer":null, 
"multiTermAnalyzer":null, "similarity":null, …}`.
     **After:** 23,261 bytes, byte-for-byte the size of `curl …/schema`'s 
`schema` section: 
`{"name":"text_general","class":"solr.TextField","positionIncrementGap":"100", 
"indexAnalyzer":{…}, …}`.
   - `SchemaServiceIntegrationTest.getSchema_serializesToTheSchemaApiResponse`: 
the serialized record equals Solr's Schema API response, compared as parsed 
JSON.
   - `SchemaServiceTest.getSchema_keepsPropertiesTheRecordsDoNotDeclare`: an 
unknown field property and an unknown top-level section reach the JSON at the 
level Solr sent them, with no `other` key.
   - `McpClientIntegrationTestBase.getSchema` (through Spring AI's 
serialization): `class` sits at the top level of a field type, there is no 
`attributes` wrapper and no `other` key, and the arrays are present.
   - `./gradlew build`: 460 tests, 0 failures, 0 skipped.
   - `./gradlew nativeTest -Pnative`: 303 successful, 0 failed; the round-trip 
test and both MCP `getSchema` tests (HTTP and STDIO) pass in the native image. 
The 154 skipped are the `@DisabledInNativeImage` Mockito tests.
   
   ## Merge Danger
   
   **Door:** two-way
   
   Reverting restores the SolrJ type.
   
   **Blast Radius:** schema-consumers
   
   The JSON shape of `get-schema` and `solr://{collection}/schema` changes: 
field-type properties move out of `attributes` to the top level, as the Schema 
API sends them, and the null analyzer slots disappear. A client that parsed the 
SolrJ shape has to read the Schema API shape instead. Java callers of 
`SchemaService.getSchema` get `CollectionSchema` instead of 
`SchemaRepresentation`.
   
   🤖 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]

Reply via email to