Skip to content

Commit

Permalink
#642 ignoring underscore in facet names
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Jan 8, 2025
1 parent 0c2eada commit 7b827db
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -287,4 +287,8 @@ protected Map<String, String[]> toCaseInsensitiveParams(NativeWebRequest webRequ
Collectors.toMap(
e -> e.getKey().toLowerCase(), Map.Entry::getValue, ArrayUtils::addAll));
}

protected String normalizeFacet(String facet) {
return facet.toLowerCase().replace("_", "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ public Object resolveArgument(
}

private Function<String, CollectionFacetParameter> facetParamParser() {
return s -> CollectionFacetParameter.valueOf(s.toUpperCase());
return s -> {
for (CollectionFacetParameter value : CollectionFacetParameter.values()) {
if (normalizeFacet(value.name()).equals(normalizeFacet(s))) {
return value;
}
}
return null;
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ public Object resolveArgument(
}

private Function<String, InstitutionFacetParameter> facetParamParser() {
return s -> InstitutionFacetParameter.valueOf(s.toUpperCase());
return s -> {
for (InstitutionFacetParameter value : InstitutionFacetParameter.values()) {
if (normalizeFacet(value.name()).equals(normalizeFacet(s))) {
return value;
}
}
return null;
};
}
}

0 comments on commit 7b827db

Please sign in to comment.