Skip to content

Commit

Permalink
Merge pull request #12791 from BiyonFernando/api-search
Browse files Browse the repository at this point in the history
Improve behaviour of API search with context as the property
  • Loading branch information
Arshardh authored Feb 3, 2025
2 parents fee8274 + 9302cf3 commit 29d9d61
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = "\"\"";
}
}
}
}

Expand Down

0 comments on commit 29d9d61

Please sign in to comment.