Repository navigation
SOLR-8003: A glob followed by a raw value transformer now writes each matching field raw - #5140
Draft
nick-boss-tech wants to merge 7 commits into
Draft
nick-boss-tech wants to merge 7 commits into
nick-boss-tech wants to merge 7 commits into
Conversation
…:[json]) Hypothetical, unrun regression test; see SOLR-8003-TESTING.md.
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.
🤖 AI text below 🤖 (posted on behalf of Nick Shanin)
https://issues.apache.org/jira/browse/SOLR-8003
What happens today
A glob cannot take a raw value transformer, so
fl=*_json:[json]returns a 400 error.A request such as
fl=*_json:[json]orfl=su*:[json]is rejected with a 400. The*_jsonform fails with a "fieldname parse error"; thesu*form fails with an "undefined field" error namingsu, the text before the*. The parser accepts a glob only when a space, a comma or the end of the string follows it (SolrReturnFields.java lines 307-316 at the merge-base). It then gives up on the glob (lines 332-333 at the merge-base). Today a raw transformer works only on one named field, so writing every_jsonfield raw means listing each name.What this change does
A glob followed by a raw value transformer now writes each matching field raw.
fl=*_json:[json]andfl=su*:[json]are accepted. Each returned field whose name matches is written raw, under its own name (SolrReturnFields.java lines 318-347 at the head). A bare*before a raw transformer, such asfl=*:[json], is rejected with a 400 that names the named-glob form instead (lines 320-325).[json]and[xml].su*:[docid], still returns a 400 (lines 333-341).Proof
A new test fails on the base code and passes with this change.
TestRawTransformer.testGlobJsonTransformer(test lines 350-408) sendsfl=id,su*:[json],link?:[json]and checks the raw output. It then sendsfl=au*:[xml], which is not applied to a JSON response, andfl=su*:[docid], which returns a 400. On the base code the first request is rejected with a 400, so the test fails there.TestRawTransformer.testSuffixGlobJsonTransformer(test lines 411-454) sendsfl=id,*_json:[json], the form used as the example above, parses the response, and checks that each returned document writes itspayload_jsonfield raw. It then sendsfl=*:[json]and checks that the request is rejected with a 400. On the base code the*_jsonrequest is rejected with a 400, "Error parsing fieldname: Expected identifier at pos 0 str='*_json:[json]'", so this test fails there.Limits
Only the JSON writer is tested with a glob. Some combinations are not covered.
wt=json. The XML writer is not tested with a glob.renameFields, and nested child documents, are not tested.Changelog: changelog/unreleased/SOLR-8003-fl-glob-raw-transformer.yml
AI assistance
AI agents assisted with research, implementation, review, and drafting. Nick Shanin directed the work and takes responsibility for this contribution.