Skip to content

Commit 7811f24

Browse files
committed
RESTWS-934 Improve location search by tag performance
1 parent e209db9 commit 7811f24

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/resource/openmrs1_8/LocationResource1_8.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
*/
1010
package org.openmrs.module.webservices.rest.web.v1_0.resource.openmrs1_8;
1111

12+
import java.util.Arrays;
1213
import java.util.List;
1314

1415
import io.swagger.models.Model;
@@ -267,7 +268,7 @@ protected PageableResult doSearch(RequestContext context) {
267268

268269
if (tagUuid != null) {
269270
LocationTag locationTag = locationService.getLocationTagByUuid(tagUuid);
270-
locationsByTag = locationService.getLocationsByTag(locationTag);
271+
locationsByTag = locationService.getLocationsHavingAllTags(Arrays.asList(locationTag));
271272
}
272273

273274
if (query != null) {

omod-1.8/src/main/java/org/openmrs/module/webservices/rest/web/v1_0/search/openmrs1_8/LocationSearchHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
package org.openmrs.module.webservices.rest.web.v1_0.search.openmrs1_8;
1111

1212
import java.util.ArrayList;
13+
import java.util.Arrays;
1314
import java.util.Collections;
1415
import java.util.List;
1516

@@ -64,7 +65,7 @@ public PageableResult search(RequestContext context) throws ResponseException {
6465
}
6566

6667
if (locationTag != null) {
67-
locations = Context.getLocationService().getLocationsByTag(locationTag);
68+
locations = Context.getLocationService().getLocationsHavingAllTags(Arrays.asList(locationTag));
6869
}
6970
}
7071
finally {

0 commit comments

Comments
 (0)