removed coordextractor and moved to token (looks cleaner and more in line with how the other ones are parsed)
This commit is contained in:
parent
dd137a0a30
commit
299e1e35e1
|
@ -3468,7 +3468,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
}
|
||||
|
||||
@Test
|
||||
public void testNearSearch() {
|
||||
public void testNearSearchExact() {
|
||||
Location loc = new Location();
|
||||
double latitude = 1000.0;
|
||||
double longitude = 2000.0;
|
||||
|
@ -3478,7 +3478,7 @@ public class FhirResourceDaoDstu3SearchNoFtTest extends BaseJpaDstu3Test {
|
|||
|
||||
SearchParameterMap map = new SearchParameterMap();
|
||||
map.add(Location.SP_NEAR, new TokenParam(latitude + ":" + longitude));
|
||||
map.add(Location.SP_NEAR_DISTANCE, new QuantityParam(10L));
|
||||
map.add(Location.SP_NEAR_DISTANCE, new QuantityParam(0L));
|
||||
|
||||
List<String> ids = toUnqualifiedVersionlessIdValues(myLocationDao.search(map));
|
||||
assertThat(ids, contains(locId));
|
||||
|
|
|
@ -275,8 +275,9 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
case "Consent.source":
|
||||
// Consent#source-identifier has a path that isn't typed - This is a one-off to deal with that
|
||||
return;
|
||||
// FIXME KHS
|
||||
case "Location.position":
|
||||
ourLog.warn("Position search not currently supported, not indexing location");
|
||||
addCoords_Position(resourceTypeName, params, searchParam, value);
|
||||
return;
|
||||
case "StructureDefinition.context":
|
||||
// TODO: implement this
|
||||
|
@ -336,19 +337,19 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
return extractSearchParams(theResource, extractor, RestSearchParameterTypeEnum.URI);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource) {
|
||||
IExtractor<ResourceIndexedSearchParamCoords> extractor = (params, searchParam, value, path) -> {
|
||||
if (value.getClass().equals(myLocationPositionDefinition.getImplementingClass())) {
|
||||
String resourceType = toRootTypeName(theResource);
|
||||
addCoords_Position(resourceType, params, searchParam, value);
|
||||
} else {
|
||||
addUnexpectedDatatypeWarning(params, searchParam, value);
|
||||
}
|
||||
};
|
||||
|
||||
return extractSearchParams(theResource, extractor, RestSearchParameterTypeEnum.TOKEN);
|
||||
}
|
||||
// @Override
|
||||
// public SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource) {
|
||||
// IExtractor<ResourceIndexedSearchParamCoords> extractor = (params, searchParam, value, path) -> {
|
||||
// if (value.getClass().equals(myLocationPositionDefinition.getImplementingClass())) {
|
||||
// String resourceType = toRootTypeName(theResource);
|
||||
// addCoords_Position(resourceType, params, searchParam, value);
|
||||
// } else {
|
||||
// addUnexpectedDatatypeWarning(params, searchParam, value);
|
||||
// }
|
||||
// };
|
||||
//
|
||||
// return extractSearchParams(theResource, extractor, RestSearchParameterTypeEnum.TOKEN);
|
||||
// }
|
||||
|
||||
@Override
|
||||
public SearchParamSet<ResourceIndexedSearchParamDate> extractSearchParamDates(IBaseResource theResource) {
|
||||
|
@ -723,7 +724,7 @@ public abstract class BaseSearchParamExtractor implements ISearchParamExtractor
|
|||
}
|
||||
|
||||
// FIXME KHS split this class up
|
||||
private void addCoords_Position(String theResourceType, SearchParamSet<ResourceIndexedSearchParamCoords> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
|
||||
private void addCoords_Position(String theResourceType, SearchParamSet<BaseResourceIndexedSearchParam> theParams, RuntimeSearchParam theSearchParam, IBase theValue) {
|
||||
BigDecimal latitude = null;
|
||||
BigDecimal longitude = null;
|
||||
if (theValue instanceof Location.LocationPositionComponent) {
|
||||
|
|
|
@ -28,7 +28,7 @@ import java.util.*;
|
|||
|
||||
public interface ISearchParamExtractor {
|
||||
|
||||
SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource);
|
||||
// SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource);
|
||||
|
||||
SearchParamSet<ResourceIndexedSearchParamDate> extractSearchParamDates(IBaseResource theResource);
|
||||
|
||||
|
|
|
@ -67,15 +67,17 @@ public class SearchParamExtractorService {
|
|||
handleWarnings(theRequestDetails, myInterceptorBroadcaster, uris);
|
||||
theParams.myUriParams.addAll(uris);
|
||||
|
||||
ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamCoords> coords = extractSearchParamCoords(theResource);
|
||||
handleWarnings(theRequestDetails, myInterceptorBroadcaster, coords);
|
||||
theParams.myCoordsParams.addAll(coords);
|
||||
// ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamCoords> coords = extractSearchParamCoords(theResource);
|
||||
// handleWarnings(theRequestDetails, myInterceptorBroadcaster, coords);
|
||||
// theParams.myCoordsParams.addAll(coords);
|
||||
|
||||
ourLog.trace("Storing date indexes: {}", theParams.myDateParams);
|
||||
|
||||
for (BaseResourceIndexedSearchParam next : extractSearchParamTokens(theResource)) {
|
||||
if (next instanceof ResourceIndexedSearchParamToken) {
|
||||
theParams.myTokenParams.add((ResourceIndexedSearchParamToken) next);
|
||||
} else if (next instanceof ResourceIndexedSearchParamCoords) {
|
||||
theParams.myCoordsParams.add((ResourceIndexedSearchParamCoords) next);
|
||||
} else {
|
||||
theParams.myStringParams.add((ResourceIndexedSearchParamString) next);
|
||||
}
|
||||
|
@ -113,9 +115,9 @@ public class SearchParamExtractorService {
|
|||
}
|
||||
}
|
||||
|
||||
private ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource) {
|
||||
return mySearchParamExtractor.extractSearchParamCoords(theResource);
|
||||
}
|
||||
// private ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamCoords> extractSearchParamCoords(IBaseResource theResource) {
|
||||
// return mySearchParamExtractor.extractSearchParamCoords(theResource);
|
||||
// }
|
||||
|
||||
private ISearchParamExtractor.SearchParamSet<ResourceIndexedSearchParamDate> extractSearchParamDates(IBaseResource theResource) {
|
||||
return mySearchParamExtractor.extractSearchParamDates(theResource);
|
||||
|
|
|
@ -197,9 +197,9 @@ public class SearchParamExtractorDstu3Test {
|
|||
|
||||
SearchParamExtractorDstu3 extractor = new SearchParamExtractorDstu3(new ModelConfig(), ourCtx, ourValidationSupport, searchParamRegistry);
|
||||
extractor.start();
|
||||
Set<ResourceIndexedSearchParamCoords> coords = extractor.extractSearchParamCoords(loc);
|
||||
ISearchParamExtractor.SearchParamSet<BaseResourceIndexedSearchParam> coords = extractor.extractSearchParamTokens(loc);
|
||||
assertEquals(1, coords.size());
|
||||
ResourceIndexedSearchParamCoords coord = coords.iterator().next();
|
||||
ResourceIndexedSearchParamCoords coord = (ResourceIndexedSearchParamCoords) coords.iterator().next();
|
||||
assertEquals(latitude, coord.getLatitude(), 0.0);
|
||||
assertEquals(longitude, coord.getLongitude(), 0.0);
|
||||
}
|
||||
|
|
|
@ -178,9 +178,10 @@ public class SearchParamExtractorMegaTest {
|
|||
|
||||
ISearchParamExtractor.SearchParamSet<?> set;
|
||||
|
||||
set = theExtractor.extractSearchParamCoords(resource);
|
||||
assertEquals(0, set.getWarnings().size());
|
||||
theIndexesCounter.addAndGet(set.size());
|
||||
// FIXME KHS
|
||||
// set = theExtractor.extractSearchParamCoords(resource);
|
||||
// assertEquals(0, set.getWarnings().size());
|
||||
// theIndexesCounter.addAndGet(set.size());
|
||||
|
||||
set = theExtractor.extractSearchParamDates(resource);
|
||||
assertEquals(0, set.getWarnings().size());
|
||||
|
|
Loading…
Reference in New Issue