From 92f78de2785a17c873ec7ca26be310d820c62811 Mon Sep 17 00:00:00 2001 From: le-maire Date: Wed, 18 Oct 2023 17:39:29 +0200 Subject: [PATCH] =?UTF-8?q?Add=20:=20ajout=20d'un=20iddocToRestart,=20pour?= =?UTF-8?q?=20reprendre=20le=20batch=20=C3=A0=20un=20iddoc=20donn=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../reader/TheseItemReader.java | 5 ++++- .../tasklet/InitialiserIndexESTasklet.java | 10 ++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/abes/theses_batch_indexation/reader/TheseItemReader.java b/src/main/java/fr/abes/theses_batch_indexation/reader/TheseItemReader.java index 176520f..24e7fce 100644 --- a/src/main/java/fr/abes/theses_batch_indexation/reader/TheseItemReader.java +++ b/src/main/java/fr/abes/theses_batch_indexation/reader/TheseItemReader.java @@ -27,6 +27,9 @@ public class TheseItemReader { @Value("${index.name}") private String nomIndex; + @Value("${iddocToRestart}") + private Integer iddocToRestart; + @Value("${table.name}") private String nomTable; @@ -68,7 +71,7 @@ private void setWhereClause(OraclePagingQueryProvider queryProvider) { queryProvider.setWhereClause("where nom_index = '" + nomIndex + "'"); } else { if (config.getWhereLimite() > 0) - queryProvider.setWhereClause("where rownum < " + config.getWhereLimite()); + queryProvider.setWhereClause("where rownum < " + config.getWhereLimite() + " AND iddoc >= " + iddocToRestart.toString()); } } diff --git a/src/main/java/fr/abes/theses_batch_indexation/tasklet/InitialiserIndexESTasklet.java b/src/main/java/fr/abes/theses_batch_indexation/tasklet/InitialiserIndexESTasklet.java index 22506d9..137d1f2 100644 --- a/src/main/java/fr/abes/theses_batch_indexation/tasklet/InitialiserIndexESTasklet.java +++ b/src/main/java/fr/abes/theses_batch_indexation/tasklet/InitialiserIndexESTasklet.java @@ -39,9 +39,19 @@ public class InitialiserIndexESTasklet implements Tasklet { @Value("${index.pathRecherchePersonnes}") private String pathRecherchePersonnes; + @Value("${iddocToRestart}") + private Integer iddocToRestart; + @Override public RepeatStatus execute(StepContribution stepContribution, ChunkContext chunkContext) throws Exception { + + if (iddocToRestart > 0) { + log.warn("Index " + nomIndex.toLowerCase() + " non réinitialisé," + + " car reprise de l'indexation à partir de l'iddoc : " + iddocToRestart); + return RepeatStatus.FINISHED; + } + File f = selectIndex(); if (f != null) {