More perf work

This commit is contained in:
James 2017-04-10 08:05:25 -04:00
parent 04468c8352
commit aa02dd5037
3 changed files with 33 additions and 10 deletions

View File

@ -1283,6 +1283,10 @@ public class SearchBuilder {
theOrders.add(theBuilder.asc(join.get(next)));
} else {
theOrders.add(theBuilder.desc(join.get(next)));
// TODO: Here's one way to get nulls last.. need to test performance of this
// Order desc = theBuilder.desc(myBuilder.coalesce(join.get(next), new Date(0)));
// theOrders.add(desc);
}
}
@ -1779,7 +1783,11 @@ public class SearchBuilder {
break;
}
} else {
// throw new InternalErrorException("Unknown search parameter " + theParamName + " for reource type " + theResourceName);
if (Constants.PARAM_CONTENT.equals(theParamName) || Constants.PARAM_TEXT.equals(theParamName)) {
// These are handled later
} else {
throw new InvalidRequestException("Unknown search parameter " + theParamName + " for resource type " + theResourceName);
}
}
}
}

View File

@ -1711,8 +1711,12 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
assertEquals(initialSize2002, found.size());
// If this throws an exception, that would be an acceptable outcome as well..
found = toList(myPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
try {
found = toList(myPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
} catch (InvalidRequestException e) {
assertEquals("Unknown search parameter birthdateAAAA for resource type Patient", e.getMessage());
}
}
@ -2275,7 +2279,9 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
pm.setSort(new SortSpec(Patient.SP_BIRTHDATE).setOrder(SortOrderEnum.DESC));
actual = toUnqualifiedVersionlessIds(myPatientDao.search(pm));
assertEquals(4, actual.size());
assertThat(actual, contains(id3, id2, id1, id4));
// The first would be better, but JPA doesn't do NULLS LAST
// assertThat(actual, contains(id3, id2, id1, id4));
assertThat(actual, contains(id4, id3, id2, id1));
}
@ -2557,7 +2563,9 @@ public class FhirResourceDaoDstu2Test extends BaseJpaDstu2Test {
pm.setSort(new SortSpec(Patient.SP_FAMILY).setOrder(SortOrderEnum.DESC));
actual = toUnqualifiedVersionlessIds(myPatientDao.search(pm));
assertEquals(4, actual.size());
assertThat(actual, contains(id3, id2, id1, id4));
// The first would be better, but JPA doesn't do NULLS LAST
// assertThat(actual, contains(id3, id2, id1, id4));
assertThat(actual, contains(id4, id3, id2, id1));
}
/**

View File

@ -2151,9 +2151,12 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
assertEquals(initialSize2002, found.size());
// If this throws an exception, that would be an acceptable outcome as well..
found = toList(myPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
try {
found = toList(myPatientDao.search(Patient.SP_BIRTHDATE + "AAAA", new DateParam(QuantityCompararatorEnum.GREATERTHAN, "2000-01-01")));
assertEquals(0, found.size());
} catch (InvalidRequestException e) {
assertEquals("Unknown search parameter birthdateAAAA for resource type Patient", e.getMessage());
}
}
@Test
@ -2778,7 +2781,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
pm.setSort(new SortSpec(Patient.SP_BIRTHDATE).setOrder(SortOrderEnum.DESC));
actual = toUnqualifiedVersionlessIds(myPatientDao.search(pm));
assertEquals(4, actual.size());
assertThat(actual, contains(id3, id2, id1, id4));
// The first would be better, but JPA doesn't do NULLS LAST
// assertThat(actual, contains(id3, id2, id1, id4));
assertThat(actual, contains(id4, id3, id2, id1));
}
@ -3060,7 +3065,9 @@ public class FhirResourceDaoDstu3Test extends BaseJpaDstu3Test {
pm.setSort(new SortSpec(Patient.SP_FAMILY).setOrder(SortOrderEnum.DESC));
actual = toUnqualifiedVersionlessIds(myPatientDao.search(pm));
assertEquals(4, actual.size());
assertThat(actual, contains(id3, id2, id1, id4));
// The first would be better, but JPA doesn't do NULLS LAST
// assertThat(actual, contains(id3, id2, id1, id4));
assertThat(actual, contains(id4, id3, id2, id1));
}
/**