Skip to content

test(data): ship the shows sample dataset as CSV, XML and Markdown too - #201

Closed
adityamparikh wants to merge 10 commits into
apache:mainfrom
adityamparikh:feat/shows-sample-formats
Closed

adityamparikh wants to merge 10 commits into
apache:mainfrom
adityamparikh:feat/shows-sample-formats

Conversation

@adityamparikh

@adityamparikh adityamparikh commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

shows.json is the dataset the tutorial and the hackathon card index. The same 61 shows now ship in every format the indexing tools accept, so the walkthrough can be followed in whichever one a reader has:

File Shape
src/test/resources/shows.csv One row per show. Multi-valued fields (genres, creators, cast, tags) are repeated column headers; the CSV creator adds one value per non-empty cell under the same field name, so the documents match JSON field for field.
src/test/resources/shows.xml Solr update XML: <add> with one <doc> per record and repeated <field name="genres"> elements for lists, the format index-xml-documents forwards to Solr (#205).
src/test/resources/shows-markdown/<id>.md One file per show: every field in YAML front matter, the description as the body under a # Title heading. One Markdown document is one Solr document, hence 61 files.

ShowsSampleDataTest pins that the formats the server parses itself (JSON and Markdown) yield the same 61 documents; ShowsSampleDataIntegrationTest indexes the JSON, CSV and XML files through the tools into a real Solr and asserts the three collections hold identical documents. CSV and XML go through Solr's own handlers (#205), so this branch carries #205 as a merge until it lands; merge #205 first and this diff shrinks to the data files, the tests and the native include.

The native test binary needs an explicit -H:IncludeResources for the three new flavours; Spring AOT only registers *.json resources, which is why shows.json already worked natively.

Verification

  • ./gradlew build on Java 25: green, ShowsSampleDataTest 4/4.
  • ./gradlew nativeTest -Pnative on GraalVM CE 25.0.2: green including the four new tests (the first run failed on the missing resources, which is what the build change fixes).
  • Each format was also pushed through a running server's indexing tool into Solr: 61 of 61 for CSV and XML, one document per Markdown file.
  • Rebuilt with refactor(indexing): forward CSV and XML to Solr's own update handlers #205 merged in: ./gradlew build green, including the end-to-end equality test.

🤖 Generated with Claude Code

https://claude.ai/code/session_01CiUHyyXLTo9ATdgg8eRFZJ

adityamparikh and others added 3 commits September 13, 2026 16:23
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>
adityamparikh and others added 3 commits September 13, 2026 23:42
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
attributes keep the _attr suffix: unqualified on the record (id_attr),
qualified by the element on a child (name_lang_attr). 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>
Depends on the XML record-mapping fix; with it, the record element is a
wrapper and shows.xml yields id, title and multi-valued genres like 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>
adityamparikh and others added 4 commits September 14, 2026 10:11
Solr already parses CSV and its own update XML; the server's CSV and XML
document creators re-implemented that with conventions of their own (a
generic-XML mapping that prefixed every field with the record element and
dropped the id). Both creators are gone. index-csv-documents reads only the
header, sanitizes the column names, and forwards the payload to Solr's CSV
handler with those names as fieldnames; repeated columns are multi-valued
and empty cells skipped, as before. index-xml-documents takes Solr update
XML (<add><doc><field name=...>) and forwards it.

The one thing the server still checks on XML is the root element: Solr's
update grammar also carries <delete>, <commit>, <optimize> and <rollback>
on the same endpoint, so an indexing tool that forwarded blindly would be a
delete tool. UpdatePayloads.inspectXml does that check with a hardened StAX
read (no DTD, no external entities) and counts documents and field names
for the response, without building a document model. Solr accepts or
rejects each payload as a whole; the per-document retry no longer applies
to these two 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>
CSV and XML are now forwarded to Solr rather than parsed here, so the sample
XML is Solr's own <add><doc><field name=...> format and the check that the
same 61 shows come out identical from JSON, CSV and XML moves to
ShowsSampleDataIntegrationTest, which indexes all three through the tools
into a real Solr and compares the documents.

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>
Two titles contained ': ' unquoted, which a YAML parser rejects and only
the line-by-line reader tolerated. The files are now emitted by a YAML
library, so they hold under apache#206 and under the current reader alike.

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>
adityamparikh added a commit to adityamparikh/solr-mcp that referenced this pull request Sep 14, 2026
…egration tests

Port shows.csv, shows.xml, and ShowsSampleDataIntegrationTest from PR apache#201.
The integration test verifies that JSON, CSV, and XML datasets index the
exact same 61 documents into Solr.

Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Co-authored-by: Junie <junie@jetbrains.com>
adityamparikh added a commit to adityamparikh/solr-mcp that referenced this pull request Sep 14, 2026
Port shows-markdown/ (61 show records) and ShowsSampleDataTest from PR apache#201.
Validates that SnakeYAML front matter parsing produces documents matching
shows.json across all 61 records.

Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Co-authored-by: Junie <junie@jetbrains.com>
@adityamparikh

Copy link
Copy Markdown
Contributor Author

Closing as superseded and distributed into format-specific PRs:

  1. CSV & XML Data + Integration Tests -> Integrated into PR refactor(indexing): forward CSV and XML to Solr's own update handlers #205 (fix/xml-record-mapping). shows.csv, shows.xml, and ShowsSampleDataIntegrationTest validate Solr's native /update handler streaming directly against Testcontainers.
  2. Markdown Data + Parser Tests -> Integrated into PR refactor(indexing): parse Markdown front matter with SnakeYAML #206 (refactor/markdown-front-matter-yaml). The 61 shows-markdown/ records and ShowsSampleDataTest provide comprehensive unit test coverage for SnakeYAML front-matter parsing.
  3. Core Indexing Refactoring -> PR refactor(indexing): forward CSV and XML to Solr's own update handlers #205's hardened SolrUpdateXml guard and native delegation completely supersedes the intermediate UpdatePayloads approach and drops the commons-csv dependency.

All datasets, tests, and native resource hints are preserved in their respective PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant