diff --git a/api-docs/apiLive.htm b/api-docs/apiLive.htm index d8daeaacc..1145847f6 100644 --- a/api-docs/apiLive.htm +++ b/api-docs/apiLive.htm @@ -33250,6 +33250,8 @@ Request Body:
search?query=Petra&resource=clients,groups

+
search?query=Petra&resource=clients,groups&exactMatch=true
+
@@ -33273,6 +33275,15 @@ Request Body: Scoped resources on which search can be performed. If there is no resource parameter passed then search will be performed on all scoped resources. + + + +
Parameters
+ exactMatch +
(non-mandatory) +
+ Scoped resources on which search can be performed. If there is no exactMatch parameter passed then search will be performed for all partial matches scoped resources. +

@@ -33320,6 +33331,40 @@ GET https://DomainName/api/v1/search?query=000000111 } ] + + +GET https://DomainName/api/v1/search?query=000000001&exactMatch=true + + +[{ + "entityId": 1, + "entityAccountNo": "000000001", + "entityExternalId": "ID_JKZGEXF", + "entityName": "Group_Name_HVCU5", + "entityType": "GROUP", + "parentId": 1, + "parentName": "Head Office", + "entityStatus": { + "id": 300, + "code": "groupingStatusType.active", + "value": "Active" + } +}, +{ + "entityId": 1, + "entityAccountNo": "000000001", + "entityExternalId": "ID_UOZAGPZ", + "entityName": "Client_FirstName_KJ5B6 Client_LastName_KDGX", + "entityType": "CLIENT", + "parentId": 1, + "parentName": "Head Office", + "entityStatus": { + "id": 300, + "code": "clientStatusType.active", + "value": "Active" + } +}] +   diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/api/SearchApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/api/SearchApiResource.java index 278d38dd6..a7afbf948 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/api/SearchApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/api/SearchApiResource.java @@ -9,6 +9,7 @@ import java.util.Collection; import java.util.Set; import javax.ws.rs.Consumes; +import javax.ws.rs.DefaultValue; import javax.ws.rs.GET; import javax.ws.rs.POST; import javax.ws.rs.Path; @@ -72,11 +73,8 @@ public class SearchApiResource { @Consumes({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON }) public String searchData(@Context final UriInfo uriInfo, @QueryParam("query") final String query, - @QueryParam("resource") final String resource ,@QueryParam("exactMatch") Boolean exactMatch) { + @QueryParam("resource") final String resource ,@DefaultValue("false") @QueryParam("exactMatch") Boolean exactMatch) { - if (exactMatch == null) { - exactMatch = false; - } final SearchConditions searchConditions = new SearchConditions(query, resource,exactMatch); final Collection searchResults = this.searchReadPlatformService.retriveMatchingData(searchConditions);