Skip to content

Commit

Permalink
Merge pull request #112 from abes-esr/develop
Browse files Browse the repository at this point in the history
Merge dev dans main
  • Loading branch information
SamuelQuetin authored Jan 15, 2025
2 parents 8eaeab5 + 0cd849d commit e0aa1ad
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
</parent>
<groupId>fr.abes</groupId>
<artifactId>sudoc</artifactId>
<version>1.1.2</version>
<version>1.1.3-SNAPSHOT</version>
<packaging>jar</packaging>
<name>sudoc</name>
<description>webservices de récupération de ppns dans le sudoc</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ public List<String> 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);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/abes/sudoc/utils/Utilitaire.java
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions src/test/java/fr/abes/sudoc/utils/UtilitaireTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
}
}

0 comments on commit e0aa1ad

Please sign in to comment.