Review changes for new _pid SP. (#5430)

Change name to _pid to match our standard and add warning.
This commit is contained in:
michaelabuckley 2023-11-03 18:07:05 -04:00 committed by GitHub
parent 2ef2924b86
commit 917f69c784
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 18 additions and 16 deletions

View File

@ -199,7 +199,7 @@ public class Constants {
public static final String PARAM_PRETTY_VALUE_FALSE = "false";
public static final String PARAM_PRETTY_VALUE_TRUE = "true";
public static final String PARAM_PROFILE = "_profile";
public static final String PARAM__PID = "__pid";
public static final String PARAM_PID = "_pid";
public static final String PARAM_QUERY = "_query";
public static final String PARAM_RESPONSE_URL = "response-url"; // Used in messaging

View File

@ -1,5 +1,5 @@
---
type: add
issue: 5428
title: "Add support for non-standard __pid SearchParameter to the the JPA engine.
title: "Add support for non-standard _pid SearchParameter to the the JPA engine.
This new SP provides an efficient tie-breaking sort key."

View File

@ -22,11 +22,13 @@ Searching on Location.Position using `near` currently uses a box search, not a r
The special `_filter` is only partially implemented.
### __pid
### _pid
The JPA server implements a non-standard special `__pid` which matches/sorts on the raw internal database id.
The JPA server implements a non-standard special `_pid` which matches/sorts on the raw internal database id.
This sort is useful for imposing tie-breaking sort order in an efficient way.
Note that this is an internal feature that may change or be removed in the future. Use with caution.
<a name="uplifted-refchains"/>
# Uplifted Refchains and Chaining Performance

View File

@ -2293,7 +2293,7 @@ public class QueryStack {
null,
theSearchForIdsParams.myRequestPartitionId);
case Constants.PARAM__PID:
case Constants.PARAM_PID:
return createPredicateResourcePID(
theSearchForIdsParams.mySourceJoinColumn, theSearchForIdsParams.myAndOrParams);

View File

@ -838,7 +838,7 @@ public class SearchBuilder implements ISearchBuilder<JpaPid> {
theQueryStack.addSortOnResourceId(ascending);
} else if (Constants.PARAM__PID.equals(theSort.getParamName())) {
} else if (Constants.PARAM_PID.equals(theSort.getParamName())) {
theQueryStack.addSortOnResourcePID(ascending);

View File

@ -51,8 +51,8 @@ public class ResourceMetaParams {
Map<String, Class<? extends IQueryParameterAnd<?>>> resourceMetaAndParams = new HashMap<>();
resourceMetaParams.put(IAnyResource.SP_RES_ID, StringParam.class);
resourceMetaAndParams.put(IAnyResource.SP_RES_ID, StringAndListParam.class);
resourceMetaParams.put(Constants.PARAM__PID, TokenParam.class);
resourceMetaAndParams.put(Constants.PARAM__PID, TokenAndListParam.class);
resourceMetaParams.put(Constants.PARAM_PID, TokenParam.class);
resourceMetaAndParams.put(Constants.PARAM_PID, TokenAndListParam.class);
resourceMetaParams.put(Constants.PARAM_TAG, TokenParam.class);
resourceMetaAndParams.put(Constants.PARAM_TAG, TokenAndListParam.class);
resourceMetaParams.put(Constants.PARAM_PROFILE, UriParam.class);

View File

@ -110,7 +110,7 @@ public class FhirResourceDaoR4QuerySandbox extends BaseJpaTest {
myDataBuilder.withActiveTrue(),
myDataBuilder.withFamily("Smith")).getIdPart();
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?__pid=" + id, id);
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?_pid=" + id, id);
}
@Test
@ -123,7 +123,7 @@ public class FhirResourceDaoR4QuerySandbox extends BaseJpaTest {
myDataBuilder.withActiveTrue(),
myDataBuilder.withFamily("Smith")).getIdPart();
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?name=smith&__pid=" + id, id);
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?name=smith&_pid=" + id, id);
}
@Test
@ -133,8 +133,8 @@ public class FhirResourceDaoR4QuerySandbox extends BaseJpaTest {
String id2 = myDataBuilder.createPatient(myDataBuilder.withFamily("Smithwick")).getIdPart();
String id3 = myDataBuilder.createPatient(myDataBuilder.withFamily("Smith")).getIdPart();
myTestDaoSearch.assertSearchFindsInOrder("sort by server assigned id", "Patient?family=smith&_sort=__pid", id1,id2,id3);
myTestDaoSearch.assertSearchFindsInOrder("reverse sort by server assigned id", "Patient?family=smith&_sort=-__pid", id3,id2,id1);
myTestDaoSearch.assertSearchFindsInOrder("sort by server assigned id", "Patient?family=smith&_sort=_pid", id1,id2,id3);
myTestDaoSearch.assertSearchFindsInOrder("reverse sort by server assigned id", "Patient?family=smith&_sort=-_pid", id3,id2,id1);
}
public static final class TestDirtiesContextTestExecutionListener extends DirtiesContextTestExecutionListener {

View File

@ -515,8 +515,8 @@ public class FhirResourceDaoR4StandardQueriesNoFTTest extends BaseJpaTest {
myDataBuilder.withActiveTrue(),
myDataBuilder.withFamily("Smith")).getIdPart();
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?__pid=" + id, id);
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?family=smith&__pid=" + id, id);
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?_pid=" + id, id);
myTestDaoSearch.assertSearchFindsOnly("search by server assigned id", "Patient?family=smith&_pid=" + id, id);
}
@Test
@ -526,8 +526,8 @@ public class FhirResourceDaoR4StandardQueriesNoFTTest extends BaseJpaTest {
String id2 = myDataBuilder.createPatient(myDataBuilder.withFamily("Smithwick")).getIdPart();
String id3 = myDataBuilder.createPatient(myDataBuilder.withFamily("Smith")).getIdPart();
myTestDaoSearch.assertSearchFindsInOrder("sort by server assigned id", "Patient?family=smith&_sort=__pid", id1,id2,id3);
myTestDaoSearch.assertSearchFindsInOrder("reverse sort by server assigned id", "Patient?family=smith&_sort=-__pid", id3,id2,id1);
myTestDaoSearch.assertSearchFindsInOrder("sort by server assigned id", "Patient?family=smith&_sort=_pid", id1,id2,id3);
myTestDaoSearch.assertSearchFindsInOrder("reverse sort by server assigned id", "Patient?family=smith&_sort=-_pid", id3,id2,id1);
}
@Nested