Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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."
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2293,7 +2293,7 @@ public Condition searchForIdsWithAndOr(SearchForIdsParams theSearchForIdsParams)
null,
theSearchForIdsParams.myRequestPartitionId);

case Constants.PARAM__PID:
case Constants.PARAM_PID:
return createPredicateResourcePID(
theSearchForIdsParams.mySourceJoinColumn, theSearchForIdsParams.myAndOrParams);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ private void createSort(QueryStack theQueryStack, SortSpec theSort, SearchParame

theQueryStack.addSortOnResourceId(ascending);

} else if (Constants.PARAM__PID.equals(theSort.getParamName())) {
} else if (Constants.PARAM_PID.equals(theSort.getParamName())) {

theQueryStack.addSortOnResourcePID(ascending);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ void testQueryByPid() {
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
Expand All @@ -123,7 +123,7 @@ void testQueryByPid_withOtherSPAvoidsResourceTable() {
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
Expand All @@ -133,8 +133,8 @@ void testSortByPid() {
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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -515,8 +515,8 @@ void testQueryByPid() {
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
Expand All @@ -526,8 +526,8 @@ void testSortByPid() {
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
Expand Down