eukaryote opened a new pull request, #2451: URL: https://github.com/apache/solr/pull/2451
Fixes problems with the JsonLoader's parsing of atomic update values that use multiple modifiers in a single update or reference a field name that matches a modifier (like `set` or `add`). https://issues.apache.org/jira/browse/SOLR-17274 # Description Fixes two problems with JSON atomic updates where an atomic update value like `{"set": {"set": "foo"}}` (set a field named `set` to value `foo`) or `{"foo": {"add": "bar", "remove": "baz"}}` (add `bar` value to and remove `baz` values from field `foo`) would throw an exception due to `isChildDoc` thinking a nested doc was being updated. The exact exception message was: `Unable to index docs with children: the schema must include definitions for both a uniqueKey field and the '_root_' field, using the exact same fieldType` # Solution I modified the `isChildDoc` method of `JsonLoader` to check if the schema is usable for child docs, and to return `false` if not. I also had to revert a part of the logic in `parseObjectFieldValue` so that it would return all the modifier values when there are multiple. The `isChildDoc` behavior is unchanged if the schema does support child docs, so the same error with continue to be thrown in that case. # Tests There weren't any atomic update tests that used the JSON loader previously, so I added a new schema file with the minimal fields needed to test this functionality and some tests for existing functionality via Json and for what is changed by this PR. # Checklist Please review the following and check all that apply: - [x] I have reviewed the guidelines for [How to Contribute](https://github.com/apache/solr/blob/main/CONTRIBUTING.md) and my code conforms to the standards described there to the best of my ability. - [x] I have created a Jira issue and added the issue ID to my pull request title. - [x] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended) - [x] I have developed this patch against the `main` branch. - [x] I have run `./gradlew check`. - [x] I have added tests for my changes. - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide) The only tests that failed were the S3 tests, which I believe is common and not necessarily a problem if my changes shouldn't have effected s3 functionality. -- 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-unsubscr...@solr.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org For additional commands, e-mail: issues-h...@solr.apache.org