Attribution for 5668 (#5702)

* Attribution

* Attribution
This commit is contained in:
Tadgh 2024-02-13 13:48:08 -05:00 committed by GitHub
parent 1deca0756c
commit 2caccc796b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 19 additions and 4 deletions

View File

@ -0,0 +1,4 @@
---
type: fix
issue: 5668
title: "Added support for sorting on a chained `location.near` search. This allows you to sort location by nearness via a chained search. Thanks to Nicolai Gjøderum (@nigtrifork) for the contribution!"

View File

@ -384,14 +384,20 @@ public class QueryStack {
List<List<IQueryParameterType>> params = theParams.get(theParamName); List<List<IQueryParameterType>> params = theParams.get(theParamName);
if (params != null && !params.isEmpty() && !params.get(0).isEmpty()) { if (params != null && !params.isEmpty() && !params.get(0).isEmpty()) {
IQueryParameterType locationParam = params.get(0).get(0); IQueryParameterType locationParam = params.get(0).get(0);
final SpecialParam specialParam = new SpecialParam().setValue(locationParam.getValueAsQueryToken(myFhirContext)); final SpecialParam specialParam =
new SpecialParam().setValue(locationParam.getValueAsQueryToken(myFhirContext));
ParsedLocationParam location = ParsedLocationParam.from(theParams, specialParam); ParsedLocationParam location = ParsedLocationParam.from(theParams, specialParam);
double latitudeValue = location.getLatitudeValue(); double latitudeValue = location.getLatitudeValue();
double longitudeValue = location.getLongitudeValue(); double longitudeValue = location.getLongitudeValue();
final CoordsPredicateBuilder coordsPredicateBuilder = mySqlBuilder.addCoordsPredicateBuilder(resourceLinkPredicateBuilder.getColumnTargetResourceId()); final CoordsPredicateBuilder coordsPredicateBuilder = mySqlBuilder.addCoordsPredicateBuilder(
mySqlBuilder.addSortCoordsNear(coordsPredicateBuilder, latitudeValue, longitudeValue, theAscending); resourceLinkPredicateBuilder.getColumnTargetResourceId());
mySqlBuilder.addSortCoordsNear(
coordsPredicateBuilder, latitudeValue, longitudeValue, theAscending);
} else { } else {
String msg = myFhirContext.getLocalizer().getMessageSanitized(QueryStack.class, "cantSortOnCoordParamWithoutValues", theParamName); String msg = myFhirContext
.getLocalizer()
.getMessageSanitized(
QueryStack.class, "cantSortOnCoordParamWithoutValues", theParamName);
throw new InvalidRequestException(Msg.code(2497) + msg); throw new InvalidRequestException(Msg.code(2497) + msg);
} }
return; return;

View File

@ -674,6 +674,11 @@
<organization>Trifork</organization> <organization>Trifork</organization>
<name>Martin Zacho Grønhøj</name> <name>Martin Zacho Grønhøj</name>
</developer> </developer>
<developer>
<id>nigtrifork</id>
<organization>Trifork</organization>
<name>Nicolai Gjøderum</name>
</developer>
<developer> <developer>
<id>augla</id> <id>augla</id>
<name>August Langhout</name> <name>August Langhout</name>