diff --git a/pom.xml b/pom.xml index 2a41c02..4ea2a30 100644 --- a/pom.xml +++ b/pom.xml @@ -9,7 +9,7 @@ fr.abes sudoc - 1.1.2 + 1.1.3-SNAPSHOT jar sudoc webservices de récupération de ppns dans le sudoc diff --git a/src/main/java/fr/abes/sudoc/component/BaseXmlFunctionsCaller.java b/src/main/java/fr/abes/sudoc/component/BaseXmlFunctionsCaller.java index d5bae4c..30d25b8 100644 --- a/src/main/java/fr/abes/sudoc/component/BaseXmlFunctionsCaller.java +++ b/src/main/java/fr/abes/sudoc/component/BaseXmlFunctionsCaller.java @@ -51,16 +51,16 @@ public List datToPpn(Integer date, String auteur, String titre) throws U request.append(" JOIN AUTORITES.bib_100$a b"); request.append(" ON a.ppn=b.ppn"); if (auteur != null) { - request.append(" WHERE a.typerecord != 'd' and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(") AND (").append(auteur).append(")')>0 and (substr(b.datas,10,4) = '").append(date).append("' or substr(b.datas,14,4)='").append(date).append("')"); + request.append(" WHERE a.typerecord in ('c','n') and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(") AND (").append(auteur).append(")')>0 and (substr(b.datas,10,4) = '").append(date).append("' or substr(b.datas,14,4)='").append(date).append("')"); } else { - request.append(" WHERE a.typerecord != 'd' and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(")')>0 and (substr(b.datas,10,4) = '").append(date).append("' or substr(b.datas,14,4)='").append(date).append("')"); + request.append(" WHERE a.typerecord in ('c','n') and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(")')>0 and (substr(b.datas,10,4) = '").append(date).append("' or substr(b.datas,14,4)='").append(date).append("')"); } } else { request.append(" FROM biblio_table_generale a"); if (auteur != null) { - request.append(" WHERE a.typerecord != 'd' and a.biblevel='l' and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(") AND (").append(auteur).append(")')>0"); + request.append(" WHERE a.typerecord in ('c','n') and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(") AND (").append(auteur).append(")')>0"); } else { - request.append(" WHERE a.typerecord != 'd' and a.biblevel='l' and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(")')>0"); + request.append(" WHERE a.typerecord in ('c','n') and a.typecontrol = 'm' and CONTAINS(a.citation1, '(").append(titre).append(")')>0"); } } return baseXmlJdbcTemplate.queryForList(request.toString(), String.class); diff --git a/src/main/java/fr/abes/sudoc/utils/Utilitaire.java b/src/main/java/fr/abes/sudoc/utils/Utilitaire.java index 8a6e781..ab445f3 100644 --- a/src/main/java/fr/abes/sudoc/utils/Utilitaire.java +++ b/src/main/java/fr/abes/sudoc/utils/Utilitaire.java @@ -109,7 +109,7 @@ private static String suppCaracters(String chaine) { String regex = "[" + charsToRemove.stream() .map(c -> "\\" + c) // Échapper les caractères spéciaux si nécessaire .reduce("", (acc, c) -> acc + c) + "]"; - return chaine.replaceAll(regex, ""); + return chaine.replaceAll(regex, " "); } private static String banalisationReservedWords(String chaine) { diff --git a/src/test/java/fr/abes/sudoc/utils/UtilitaireTest.java b/src/test/java/fr/abes/sudoc/utils/UtilitaireTest.java index cb036e9..2fe95b2 100644 --- a/src/test/java/fr/abes/sudoc/utils/UtilitaireTest.java +++ b/src/test/java/fr/abes/sudoc/utils/UtilitaireTest.java @@ -113,5 +113,6 @@ void testReformatageChaineDat() { Assertions.assertEquals("Assez NEAR de NEAR ces NEAR fichus NEAR TU".toUpperCase(), Utilitaire.formatString("Assez ! de _ ces ~fichus *TU")); Assertions.assertEquals("Je NEAR {AND} NEAR suis NEAR {WITHIN} NEAR content".toUpperCase(), Utilitaire.formatString("Je AND suis! within content")); Assertions.assertEquals("Je NEAR {AND} NEAR suis NEAR {WITHIN} NEAR content".toUpperCase(), Utilitaire.formatString("Je AND suis! 'WITHIN' content")); + Assertions.assertEquals("J NEAR y NEAR {AND} NEAR suis NEAR {WITHIN} NEAR content".toUpperCase(), Utilitaire.formatString("J'y AND suis! 'WITHIN' content")); } }