adityamparikh opened a new pull request, #293:
URL: https://github.com/apache/solr-mcp/pull/293
Stacked on #288 (`list-fields`) and #292 (`FieldFlags`): review the last
commit only. Rebased once both merge.
## Summary
`list-fields` and `solr://{collection}/fields` now return a `FieldListing`
record instead of Luke's `fields` and `info` sections as maps. Each field's
flag letters are decoded into SolrJ's `FieldFlag`, the enum `get-schema` uses
since #292, so Luke's `info.key` legend is no longer needed.
```diff
"platform": {
"type": "string",
- "schema": "I-SD------OF-----l",
+ "flags": ["INDEXED", "STORED", "DOC_VALUES", "OMIT_NORMS", "OMIT_TF",
"SORT_MISSING_LAST"],
"docs": 61
}
-"info": {"key": {"I": "Indexed", "T": "Tokenized", ...}, "NOTE": "..."}
```
```text
listFields(collection)
solrClient.request(LukeRequest numTerms=0 includeIndexFieldFlags=false)
objectMapper.convertValue(response.get("fields"), Map<String,
IndexedField>) # SimpleOrderedMap is a Map
FieldListing(fields)
IndexedField(type, flags, dynamicBase, docs: Long, other) # compact
constructor decodes "schema" into flags
```
- `docs` is a `Long`, so a distributed sum past 2^31 does not depend on how
it was parsed (SolrJ's `LukeResponse.FieldInfo` casts it to `Integer`).
- The letters are decoded with `FieldFlag.getFlag`, not
`LukeResponse.FieldInfo.parseFlags`, which adds `getFlag`'s result without a
null check and would throw on a letter a later Solr version adds. On an unknown
letter the letters are kept as `schema` in the catch-all.
- Every other property Luke sends is kept in a `@JsonAnySetter
@JsonAnyGetter` catch-all and written back at the same level.
- The tool description now names the flags and says to facet only on
`DOC_VALUES` fields and sort only on ones without `MULTI_VALUED`.
## Evidence
- **Before:** an agent had to read `"schema": "I-SD------OF-----l"` against
`info.key` to learn that `platform` has docValues; faceting on the schemaless
`text_general` `platform` returned an empty facet because the missing `D` went
unnoticed.
**After:** `"flags": ["INDEXED", "STORED", "DOC_VALUES", ...]`.
- `SchemaServiceTest`:
`listFields_decodesFlagsAndLeavesOutTheInfoAndIndexSections` pins the exact
JSON; `listFields_keepsADistributedDocCountPastIntegerMax` (3,000,000,000);
`listFields_keepsTheLettersWhenOneIsNotAKnownFlag` (`"I-S-----------Z"` gives
no flags and keeps the letters).
- `ListFieldsIntegrationTest.decodesLukeFlagLettersIntoFieldFlags` on real
Solr: `genre_s` (`*_s`, string) has `INDEXED`, `STORED`, `DOC_VALUES`; `year_i`
(pint) has `DOC_VALUES` and not `MULTI_VALUED`. The existing dynamicBase,
point-field and two-shard tests pass on the record.
- `McpClientIntegrationTestBase.listShowsFieldsReturnsIndexedFields`,
through Spring AI's serialization: no `info`, `id` has `flags` with `INDEXED`
and `STORED`, no `schema` letters.
- `./gradlew build`: 478 tests, 0 failures, 0 skipped.
- `./gradlew nativeTest -Pnative`: 316 successful, 0 failed;
`ListFieldsIntegrationTest` and the MCP `list-fields` tests (HTTP and STDIO)
pass in the native image. The skipped tests are the `@DisabledInNativeImage`
Mockito tests.
## Merge Danger
**Door:** two-way
**Blast Radius:** list-fields-consumers
`list-fields` is new in #288, so no released client reads its shape. Against
#288 the JSON changes: `schema` letters become `flags`, `info` is gone.
🤖 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]