nick-boss-tech opened a new pull request, #5152: URL: https://github.com/apache/solr/pull/5152
🤖 *AI text below* 🤖 *(posted on behalf of Nick Shanin)* https://issues.apache.org/jira/browse/SOLR-10424 ## What happens today **Posting JSON documents to `/update/json/docs` on the techproducts example stores only the id and the `_src_` copy.** Before this change, the sample's `params.json` set `mapUniqueKeyOnly` to true in the `_UPDATE_JSON_DOCS` set ([params.json at the base](https://github.com/nick-boss-tech/solr/blob/cabedd1d968059215188f4e7563fb303241899ed/solr/server/solr/configsets/sample_techproducts_configs/conf/params.json#L3-L5)). The `/update/json/docs` handler reads that set ([implicit handler at the base](https://github.com/nick-boss-tech/solr/blob/cabedd1d968059215188f4e7563fb303241899ed/solr/core/src/resources/ImplicitPlugins.json#L28-L31)). The sample's default `df` is `text` ([solrconfig at the base](https://github.com/nick-boss-tech/solr/blob/cabedd1d968059215188f4e7563fb303241899ed/solr/server/solr/configsets/sample_techproducts_configs/conf/solrconfig.xml#L650-L654)). So the other values go into `text` with no field name. That field is indexed but not stored ([schema at the base](https://github.com/nick-boss-tech/solr/blob/cabedd1d968059215188f4e7563fb303241899ed/solr/server/solr/configsets/sample_te chproducts_configs/conf/managed-schema.xml#L180)), so no field is indexed under its own name. ## What this change does **The sample no longer sets `mapUniqueKeyOnly` for `/update/json/docs`, so each posted field is indexed under its own name.** The `srcField` setting stays, so the `_src_` copy is still stored. The change is in the sample configset only. A user who copied the old `params.json` keeps the old behavior until that copy changes. A field that the sample schema does not define now fails the request. The sample schema has no catch-all field: the `*` dynamic field is commented out ([schema](https://github.com/nick-boss-tech/solr/blob/e629ab8bb293eb54249b426b69a559f1da0f08d7/solr/server/solr/configsets/sample_techproducts_configs/conf/managed-schema.xml#L232)), and the sample solrconfig has no chain that adds unknown fields. Before this change, those fields were dropped without an error. ## A choice to check **The sample no longer has the id-only default.** The options are: 1. Remove the default from the sample, as this change does. Posted fields are indexed under their names. 2. Keep the default and give the id-only mode its own named set, so the sample behaves as it did. Option 1 costs a new error for any post with a field the sample schema lacks. Option 2 keeps the behavior this ticket reports as unusable. Was removing the default the right call for the example, or should the id-only mode stay as the default? ## Limits **Some cases are untested, and the order of this change and SOLR-8240 matters.** - No test in this change posts a document to the sample. The solrj test `SolrExampleTests.testArbitraryJsonIndexing` does, and it was not run for this change. - The unknown-field failure described above is not tested. - [SOLR-8240](https://issues.apache.org/jira/browse/SOLR-8240) changes how `mapUniqueKeyOnly` treats `f`. Until this default is gone, requests to the sample that send `f` fail under that change, so this change should land before, or together with, SOLR-8240. Changelog: [`changelog/unreleased/SOLR-10424-techproducts-json-docs.yml`](https://github.com/nick-boss-tech/solr/blob/e629ab8bb293eb54249b426b69a559f1da0f08d7/changelog/unreleased/SOLR-10424-techproducts-json-docs.yml) ## Proof **TechproductsJsonDocsParamsTest passes 1 of 1 at this head. The test fails on the base code.** - `TechproductsJsonDocsParamsTest.testUpdateJsonDocsParamSetDoesNotDropFields` ([test](https://github.com/nick-boss-tech/solr/blob/e629ab8bb293eb54249b426b69a559f1da0f08d7/solr/core/src/test/org/apache/solr/handler/TechproductsJsonDocsParamsTest.java#L30-L42)) reads the sample `params.json`. It checks that the `_UPDATE_JSON_DOCS` set keeps `srcField` and has no `mapUniqueKeyOnly`. - On the base code (`cabedd1d968`), with only this test file added, the test fails with one failure: the check that `mapUniqueKeyOnly` is absent. - Counts at `e629ab8bb293`: TechproductsJsonDocsParamsTest 1 of 1, verified 2026-10-08 at this head. The test reads the file. It does not post a document. ### AI assistance AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution. -- 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]
