parent
1deca0756c
commit
2caccc796b
|
@ -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!"
|
|
@ -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;
|
||||||
|
|
5
pom.xml
5
pom.xml
|
@ -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>
|
||||||
|
|
Loading…
Reference in New Issue