Sort is crashing when Organization (any resource) is searched using chained search param and sort #2794
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.
Description
Ex: https://ihealth-pie.fhir.azurehealthcareapis.com/Organization?partof.name=ABC&_sort=name throws Unknown error instead of returning results back.
As part of this work item, code was added in SortRewriter class to return null expression when sort field is already part of search filter name, which is causing failure in case of chained expression.
I modified code to use the expression as it is in chained expression part.
Related issues
AB#94770
Testing
Created test data and tested below URLs.
https://localhost:44348/Organization?partof.name=Test&_sort=name - should return results without failing
https://localhost:44348/Organization?name=Test&_sort=name - should return results as before
https://localhost:44348/Patient?organization.name=Mi&_sort=name - should return results without failing
https://localhost:44348/Patient?name=Mi&_sort=name - should return results as before
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)