diff --git a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistrySearchUtil.java b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistrySearchUtil.java index 7b8f51bb7a09..de74883879d2 100644 --- a/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistrySearchUtil.java +++ b/components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistrySearchUtil.java @@ -213,6 +213,22 @@ private static String getSingleSearchCriteria(String criteria) throws APIPersist if (!searchValue.startsWith("*")) { searchValue = "*" + searchValue; } + } else { + if (CONTEXT_SEARCH_TYPE_PREFIX.equalsIgnoreCase(searchKey)) { + //Remove quotation marks and forward slash to get the context for exact search. + searchValue = searchValue.substring(1, searchValue.length() - 1); + if (searchValue.startsWith("/")) { + searchValue = searchValue.substring(1); + } + if (searchValue.endsWith("/")) { + searchValue = searchValue.substring(0, searchValue.length() - 1); + } + if (!searchValue.isEmpty()) { + searchValue = "(*\\/" + searchValue + "\\/*" + " OR " + "\\/" + searchValue + ")"; + } else { + searchValue = "\"\""; + } + } } }