docs: add a first-collection tutorial teaching schema design - #184
docs: add a first-collection tutorial teaching schema design#184adityamparikh wants to merge 3 commits into
Conversation
Adds docs/tutorial.md, a hands-on walkthrough that takes a reader from an empty Solr to a designed, queryable collection entirely through natural language. The tutorial indexes the same 61-document dataset twice: once schemaless, once with types chosen deliberately. The schemaless pass succeeds and then fails to answer an ordinary question, which motivates the second pass. That contrast is the point — the project documents how to call the tools, but not why field types decide which questions are answerable. Every claim is verified end-to-end against Solr 9 in SolrCloud mode, driven through the MCP server over STDIO: the guessed types (text_general, pdoubles, plongs), the array-wrapped documents, all eight search examples with their result counts, the facet buckets, and the introspection output. Two current defects are documented in a Known issues section rather than worked around silently, since a reader following the steps will meet both: - apache#182 — faceting a query that matches nothing throws ClassCastException, which is what the schemaless pass hits - apache#183 — collections share the _default configset, so schemaless guesses leak forward; this is why the tutorial resets Solr midway Also links the tutorial from the README documentation index. Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
Rewrites Step 2 for the behaviour after apache#185. The schemaless facet no longer throws; it returns numFound=61 with facets.platform={} — the query succeeds and simply has no breakdown to give. That is a better illustration of the point than the exception was. A stack trace reads as "something is broken"; a successful query with an empty answer is precisely the trap schemaless sets, because nothing tells you the data is fine and the field type is at fault. Also drops the apache#182 entry from Known issues, and sharpens the platform row: searching platform:prime matches all 20 Amazon Prime Video shows, which shows concretely why tokenizing a category is wrong. Re-verified against a build of the apache#185 branch over the MCP protocol: the empty facet, the 20-hit token match, the three guessed types, and the array-wrapped documents. Depends on apache#185. Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
|
Updated to assume #185 is merged — this PR now depends on it. With the empty-facet fix in place, Step 2 no longer throws. The schemaless facet returns: { "numFound": 61, "documents": [], "facets": { "platform": {} } }Which is a better illustration of the point than the exception was. A stack trace reads as Changes:
Re-verified against a build of the #185 branch, driven over the MCP protocol: the empty facet, If #185 is rejected or reworked, say so and I'll restore the previous wording — the earlier |
The note quoted the sort clause shape as {"item": ..., "order": ...}. apache#164
replaces that map with a typed SortClause record keyed on "field", so the
example would have become wrong the moment that PR merged — and this tutorial
already carries one merge-order dependency.
The underlying caveat holds either way: undeclared arguments are dropped rather
than rejected, so a misnamed one reads as a query that quietly ignored part of
the request. Keeps that, drops the key names, and points at the client's tool
inspector as the durable way to check.
Signed-off-by: Aditya Parikh <aditya.m.parikh@gmail.com>
What
Adds
docs/tutorial.md— a hands-on walkthrough taking a reader from an empty Solr to adesigned, queryable collection, entirely through natural-language conversation with an
assistant. Linked from the README documentation index.
Why
The docs cover how to connect a client and what each tool does, but nothing explains
why field types decide which questions are answerable. That gap matters here more than in
a normal Solr context: the assistant will happily index anything schemaless, and the user has
no obvious signal that they've traded away faceting and sorting until a question quietly
fails.
So the tutorial indexes the same 61-document dataset twice — once letting Solr guess, once
choosing types on purpose — and puts the two side by side:
platformtypetext_generalstring+ docValuesimdb_ratingtypepdoubles(multi-valued)pdoubleNetflix 20, Amazon Prime Video 20, HBO Max 7, …Same data, same question, same tool. The only difference is that someone decided what the
fields meant.
Verification
Every factual claim was checked end-to-end against Solr 9 in SolrCloud mode, driven through
the MCP server over STDIO — not written from what the tool signatures imply:
text_general,pdoubles,plongs) and the array-wrapped documentsGame of Thrones 9.2, combined 39)
check-healthreporting 61 docs, andget-collection-statsexposing the cache hit ratiosthe tutorial invites the reader to ask about
Known issues, documented rather than hidden
A reader following the steps will hit both of these, so the tutorial names them and links the
issues instead of quietly routing around them:
ClassCastException: ArrayList cannot be cast to NamedList. This is exactly what theschemaless pass runs into.
create-collectionbinds collections to the shared_defaultconfigset, soschemaless guesses leak into every later collection and
add-fieldsthen fails withField 'x' already exists. This is why the tutorial resets Solr midway, and the reset iscalled out as a workaround rather than presented as normal practice.
If either is fixed, the corresponding section should be trimmed — they're marked clearly
enough to find.
Notes for review
shows.jsonfromsrc/test/resources/via its GitHub URL. Referencing a testresource from user docs is a little irregular; happy to move the dataset somewhere more
deliberate if preferred.
docs/clients/*.mdconvention of a locally built imagerather than a registry reference, since no official image is published yet.
**/*.mdis RAT-excluded and the existingdocs/*.mdcarry no license header, so thisfollows suit.