-
Notifications
You must be signed in to change notification settings - Fork 529
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Fix FHIR Search query with _count=0 and SqlCustomQueryTest issue #3491
Conversation
src/Microsoft.Health.Fhir.Shared.Api/Features/Formatters/HttpContextExtensions.cs
Outdated
Show resolved
Hide resolved
...Microsoft.Health.Fhir.Shared.Api.UnitTests/Features/Formatters/HttpContextExtensionsTests.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.Health.Fhir.Shared.Tests.Integration/Persistence/SqlCustomQueryTests.cs
Show resolved
Hide resolved
src/Microsoft.Health.Fhir.Shared.Core.UnitTests/Features/Search/SearchOptionsFactoryTests.cs
Show resolved
Hide resolved
What happens if a user specifies both _count=0 and _summary? This looks like it will take whichever is later in the query parameter array. I'm going to run a test on this. |
Yeah, these queries give different results: The first one gives the number of Patients and nothing else. The FHIR spec doesn't say what should be done when multiple summary parameters are given. I feel this should be an error. Also, we have a bug. When returning just the count of resources we don't return a self link. But section 3.2.1.7.5 of the FHIR search spec says we should. I know we have an existing issue about the order of search parameters affecting results. @brendankowitz thoughts? |
Nevermind, I found the section in the spec. It says this is left up to implementations, but they recommend returning an error.
@mahajan-xor I don't think this needs to be part of this PR as it is a wider issue in our service. It is a bug though, and we should track it. I'll make an item for it. |
Bug to track this: Bug 111917: Multiple of the same parameter should be an error |
Description
Fix FHIR Serach query to return result same as _summary=count when passing _count=0.
Previously, 400 response was there for _count=0.
Fix SqlCustomQueryTest issue.
Updated following logic to fix this issue.
Related issues
Addresses [issue #3230 , #105699].
Testing
Adds unit test under SearchOperationsFactoryTests
Adds unit test under HttpContextExtensionsTests
FHIR Team Checklist
Semver Change (docs)
Patch|Skip|Feature|Breaking (reason)