From 257e848db941edf4093a7421e090c67fc40c68d8 Mon Sep 17 00:00:00 2001 From: HMS17 Date: Tue, 19 Nov 2024 16:51:50 -0500 Subject: [PATCH 1/2] [BI-2343] - GID filtering not informative --- .../utilities/response/ResponseUtils.java | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java b/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java index 6b97984f7..2b783b90c 100644 --- a/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java +++ b/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java @@ -193,6 +193,13 @@ private static List search(List data, SearchRequest searchRequest, Abstrac .collect(Collectors.toList()); } + //To enable checking for the case of Germplasm Search when the filter is accessionNumber and thereby needs to do exact match + String accessionNumFilter; + if (mapper.exists("accessionNumber")) accessionNumFilter = mapper.getField("accessionNumber").toString(); + else { + accessionNumFilter = ""; + } + if (filterFields.size() > 0){ // Apply filters List finalFilterFields = filterFields; @@ -211,6 +218,11 @@ private static List search(List data, SearchRequest searchRequest, Abstrac return recordList.stream() .anyMatch(listValue -> listValue.toString().toLowerCase().contains(filterField.getValue().toLowerCase())); + } + else if (!accessionNumFilter.isEmpty() && filterField.getField().toString().equals(accessionNumFilter)) { + //enable exact match in case of GID + return filterField.getField().apply(record).toString() + .toLowerCase().equalsIgnoreCase(filterField.getValue().toLowerCase()); } else { return filterField.getField().apply(record).toString() .toLowerCase().contains(filterField.getValue().toLowerCase()); From d389288d17f30db791185da2d68eb3bdf3d140c2 Mon Sep 17 00:00:00 2001 From: HMS17 Date: Tue, 26 Nov 2024 12:07:10 -0500 Subject: [PATCH 2/2] [BI-2343] - added entry number matching --- .../utilities/response/ResponseUtils.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java b/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java index 2b783b90c..4cee82f99 100644 --- a/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java +++ b/src/main/java/org/breedinginsight/utilities/response/ResponseUtils.java @@ -193,12 +193,17 @@ private static List search(List data, SearchRequest searchRequest, Abstrac .collect(Collectors.toList()); } - //To enable checking for the case of Germplasm Search when the filter is accessionNumber and thereby needs to do exact match + //To enable checking for the case of Germplasm Search when the filter is accessionNumber or list entry number and thereby needs to do exact match String accessionNumFilter; if (mapper.exists("accessionNumber")) accessionNumFilter = mapper.getField("accessionNumber").toString(); else { accessionNumFilter = ""; } + String entryNumFilter; + if (mapper.exists("importEntryNumber")) entryNumFilter = mapper.getField("importEntryNumber").toString(); + else { + entryNumFilter = ""; + } if (filterFields.size() > 0){ // Apply filters @@ -223,6 +228,11 @@ else if (!accessionNumFilter.isEmpty() && filterField.getField().toString().equa //enable exact match in case of GID return filterField.getField().apply(record).toString() .toLowerCase().equalsIgnoreCase(filterField.getValue().toLowerCase()); + } + else if (!entryNumFilter.isEmpty() && filterField.getField().toString().equals(entryNumFilter)) { + //enable exact match in case of entry number + return filterField.getField().apply(record).toString() + .toLowerCase().equalsIgnoreCase(filterField.getValue().toLowerCase()); } else { return filterField.getField().apply(record).toString() .toLowerCase().contains(filterField.getValue().toLowerCase());