You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "adityamparikh (via GitHub)" <gi...@apache.org> on 2026/09/14 03:09:17 UTC
[PR] fix(indexing): XML record elements are wrappers, not field prefixes [solr-mcp]
adityamparikh opened a new pull request, #204:
URL: https://github.com/apache/solr-mcp/pull/204
> Stacked on #201 (the CSV/XML/Markdown sample data); the first three commits here are that PR's. Merge #201 first and this diff shrinks to the XML fix.
### Summary
The XML creator flattened every element by its full path from the record element, so
```xml
<shows><show><id>x</id><title>T</title><genres>a</genres><genres>b</genres></show></shows>
```
produced `show_id`, `show_title`, `show_genres` and no `id` at all. Solr minted a UUID per document, re-indexing duplicated instead of replaced, and XML was the one format whose documents did not match the same data in JSON, CSV or Markdown. Anyone following the tutorial with XML had to learn a second set of field names.
The record element (the root for a single document, each repeated child for many) is now a wrapper: its child elements are the fields, named after themselves, nested elements still flatten below that with underscores (`author_name`), and attributes keep the `_attr` suffix: unqualified on the record (`id_attr`), qualified by the element on a child (`name_lang_attr`).
### What changed
- `XmlDocumentCreator.addRecordFields` replaces the prefixed walk for both the single- and multi-document strategies.
- `XmlIndexingTest` expectations drop the record prefix (52 assertions); `ShowsSampleDataTest` now asserts XML equals JSON field for field, the same check CSV and Markdown already passed.
- Tool description and javadoc describe the mapping.
### Compatibility
Field names change for anyone indexing XML today (`book_title` becomes `title`). No test or doc on `main` relied on the old names beyond `XmlIndexingTest` itself, and at 0.0.2-SNAPSHOT the old mapping was a defect rather than a contract.
Part of a set with #202 and #203; independent, any merge order.
### Verification
- `./gradlew build` on Java 25: green.
- `./gradlew nativeTest -Pnative` on GraalVM CE 25.0.2: green.
- Measured against a running server: `shows.xml` indexes 61 documents in one call with `id`, `title`, `platform` and multi-valued `genres`, the same names the JSON path produces.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ
--
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: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] fix(indexing): XML record elements are wrappers, not field prefixes [solr-mcp]
Posted by "adityamparikh (via GitHub)" <gi...@apache.org>.
adityamparikh closed pull request #204: fix(indexing): XML record elements are wrappers, not field prefixes
URL: https://github.com/apache/solr-mcp/pull/204
--
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: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org
Re: [PR] fix(indexing): XML record elements are wrappers, not field prefixes [solr-mcp]
Posted by "adityamparikh (via GitHub)" <gi...@apache.org>.
adityamparikh commented on PR #204:
URL: https://github.com/apache/solr-mcp/pull/204#issuecomment-5658729092
Closing: this was stacked on #201 and so carried the CSV, XML and Markdown sample files, which are unrelated to the XML fix. The same change, rebased onto `main` as a single commit with only `XmlDocumentCreator`, `XmlIndexingTest` and the tool docs, is the replacement PR linked below. #201's `ShowsSampleDataTest` now expects the fixed mapping and should merge after it.
Replacement: https://github.com/apache/solr-mcp/pull/205
--
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: issues-unsubscribe@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org