fix(indexing): XML record elements are wrappers, not field prefixes - #204
Closed
adityamparikh wants to merge 5 commits into
Closed
adityamparikh wants to merge 5 commits into
adityamparikh wants to merge 5 commits into
Conversation
shows.json is the dataset the tutorial and the hackathon card index. The same 61 shows now exist as shows.csv, shows.xml and one Markdown file per show under shows-markdown/, so the indexing walkthrough can be followed in whichever format a reader has. CSV carries multi-valued fields as repeated column headers, which the CSV creator turns into one value per non-empty cell under the same field name. Markdown puts every field in YAML front matter and the description in the body. XML uses one <show> element per record with repeated children for lists; the XML creator prefixes those fields with the record name (show_title) and carries no plain id, which ShowsSampleDataTest pins along with the field-for-field equality of the other three formats. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
RAT audits XML; CSV, JSON and Markdown data files are exempt. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
…est binary Spring AOT's resource hints cover every *.json file, which is why shows.json was already available to native tests; the new flavours were not, and ShowsSampleDataTest failed natively with missing-resource NPEs. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
The XML creator flattened every element by path from the record element, so <show><id>x</id><title>T</title></show> produced show_id and show_title and no id at all; Solr then minted a UUID per document and re-indexing duplicated rather than replaced. XML was the one format whose documents did not match the same data in JSON, CSV or Markdown, and the only one where a reader had to learn different field names for the tutorial's later prompts. 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, and the record's own attributes keep the _attr suffix. ShowsSampleDataTest now asserts XML equals JSON field for field, and XmlIndexingTest's expectations drop the record prefix. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Only the record element's own attributes are unqualified (id_attr); an attribute on a child keeps the element name (name_lang_attr), as before. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Contributor
Author
|
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 Replacement: #205 |
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
The XML creator flattened every element by its full path from the record element, so
produced
show_id,show_title,show_genresand noidat 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_attrsuffix: unqualified on the record (id_attr), qualified by the element on a child (name_lang_attr).What changed
XmlDocumentCreator.addRecordFieldsreplaces the prefixed walk for both the single- and multi-document strategies.XmlIndexingTestexpectations drop the record prefix (52 assertions);ShowsSampleDataTestnow asserts XML equals JSON field for field, the same check CSV and Markdown already passed.Compatibility
Field names change for anyone indexing XML today (
book_titlebecomestitle). No test or doc onmainrelied on the old names beyondXmlIndexingTestitself, 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 buildon Java 25: green../gradlew nativeTest -Pnativeon GraalVM CE 25.0.2: green.shows.xmlindexes 61 documents in one call withid,title,platformand multi-valuedgenres, the same names the JSON path produces.🤖 Generated with Claude Code
https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ