adityamparikh opened a new pull request, #176:
URL: https://github.com/apache/solr-mcp/pull/176
Verified findings from a CodeRabbit review. **Two change observable
behaviour** and update the tests that pinned the old behaviour — flagged with
⚠️ below.
## Silent data loss
- `JsonDocumentCreator` returned an empty list for a bare JSON object, so
indexing a single document **indexed nothing and still reported success**. ⚠️
`testNonArrayJsonInput` updated (0 → 1 document).
- `processArrayField` filtered out objects but not nested arrays, so a
nested array reached `asString()` and threw.
## Wrong collection resolved
- `extractCollectionName` truncated at any `_shard`, so a collection named
`orders_shard_archive` resolved to `orders`. Anchored to the real SolrCloud
core suffix `_shard<N>[_replica...]`.
⚠️ Consequently `collection_shard` (no shard number — not a core name) now
survives intact, and `data_shard1_shard2_replica_n1` resolves to `data_shard1`
rather than `data`, which is correct for a collection whose own name ends in
`_shard1`. Both test expectations updated with comments.
## Other correctness
- `SolrConfig` detected the Solr path by searching the whole URL string, so
a host named `solr` matched the `/solr/` inside the **authority** and skipped
normalisation. Also moved the SolrClient factory Javadoc, which sat above
`jsonResponseParser(ObjectMapper)`.
- `SearchService` passed sort clauses straight to `SolrQuery.SortClause`,
whose constructor calls `ORDER.valueOf()`: a missing `order` key threw NPE, an
unknown one threw an opaque error. Callers are LLMs, so the messages now say
what to send. The prompt also advertised a `sortFields` parameter that does not
exist.
- `SchemaService` cast `definition.get("name")` directly, and concatenated
an exception message into JSON — a quote or newline produced invalid JSON.
- `FieldNameSanitizer` used a locale-sensitive `toLowerCase()`; under a
Turkish locale 'I' maps to a dotless 'i' and changes the field name.
- `CollectionUtils.getFloat` Javadoc promised `0.0f` for missing values
while the method returns null.
- `Dtos`: pinned `timezone = "UTC"`. **Not a live bug** — Jackson defaults
to UTC — but setting `spring.jackson.time-zone` would emit local time carrying
a literal `Z`; verified the same instant serialises as
`1970-01-01T05:30:00.000Z` under Asia/Kolkata. Defensive pin.
- `logback-spring.xml`: scoped the HTTP console appender to `http & !stdio`.
Activating both profiles attached a stdout appender while STDIO was
transporting JSON-RPC over that stream.
🤖 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]