From 313cc2965ce633592685771f442db304057dc32d Mon Sep 17 00:00:00 2001 From: Viktor Lofgren Date: Tue, 24 Oct 2023 16:23:10 +0200 Subject: [PATCH] (index-creation) Print whether full or prio is created Previous state of saying reverse index for both was pretty confusing. --- .../index/construction/ReverseIndexConstructor.java | 6 ++++-- .../java/nu/marginalia/index/IndexConstructorMain.java | 8 ++++++-- .../index/svc/IndexQueryServiceIntegrationSmokeTest.java | 4 ++-- .../index/svc/IndexQueryServiceIntegrationTest.java | 4 ++-- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/code/features-index/index-reverse/src/main/java/nu/marginalia/index/construction/ReverseIndexConstructor.java b/code/features-index/index-reverse/src/main/java/nu/marginalia/index/construction/ReverseIndexConstructor.java index 83fe3345..8537ac0e 100644 --- a/code/features-index/index-reverse/src/main/java/nu/marginalia/index/construction/ReverseIndexConstructor.java +++ b/code/features-index/index-reverse/src/main/java/nu/marginalia/index/construction/ReverseIndexConstructor.java @@ -38,7 +38,9 @@ public class ReverseIndexConstructor { this.tmpDir = tmpDir; } - public void createReverseIndex(ProcessHeartbeat processHeartbeat, Path sourceBaseDir) throws IOException + public void createReverseIndex(ProcessHeartbeat processHeartbeat, + String processName, + Path sourceBaseDir) throws IOException { var inputs = IndexJournalFileNames.findJournalFiles(sourceBaseDir); if (inputs.isEmpty()) { @@ -46,7 +48,7 @@ public class ReverseIndexConstructor { return; } - try (var heartbeat = processHeartbeat.createProcessTaskHeartbeat(CreateReverseIndexSteps.class, "createReverseIndex")) { + try (var heartbeat = processHeartbeat.createProcessTaskHeartbeat(CreateReverseIndexSteps.class, processName)) { heartbeat.progress(CreateReverseIndexSteps.CONSTRUCT); diff --git a/code/processes/index-constructor-process/src/main/java/nu/marginalia/index/IndexConstructorMain.java b/code/processes/index-constructor-process/src/main/java/nu/marginalia/index/IndexConstructorMain.java index 0045a53f..42a2f888 100644 --- a/code/processes/index-constructor-process/src/main/java/nu/marginalia/index/IndexConstructorMain.java +++ b/code/processes/index-constructor-process/src/main/java/nu/marginalia/index/IndexConstructorMain.java @@ -111,7 +111,9 @@ public class IndexConstructorMain { new ReverseIndexConstructor(outputFileDocs, outputFileWords, IndexJournalReader::singleFile, this::addRankToIdEncoding, tmpDir) - .createReverseIndex(heartbeat, workDir); + .createReverseIndex(heartbeat, + "createReverseIndexFull", + workDir); } @@ -129,7 +131,9 @@ public class IndexConstructorMain { new ReverseIndexConstructor(outputFileDocs, outputFileWords, (path) -> IndexJournalReader.singleFile(path).filtering(wordMetaFilter), this::addRankToIdEncoding, tmpDir) - .createReverseIndex(heartbeat, workDir); + .createReverseIndex(heartbeat, + "createReverseIndexPrio", + workDir); } private static LongPredicate getPriorityIndexWordMetaFilter() { diff --git a/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationSmokeTest.java b/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationSmokeTest.java index bea35975..bf7641a6 100644 --- a/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationSmokeTest.java +++ b/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationSmokeTest.java @@ -242,7 +242,7 @@ public class IndexQueryServiceIntegrationSmokeTest { if (!Files.isDirectory(tmpDir)) Files.createDirectories(tmpDir); new ReverseIndexConstructor(outputFileDocs, outputFileWords, IndexJournalReader::singleFile, DocIdRewriter.identity(), tmpDir) - .createReverseIndex(new FakeProcessHeartbeat(), workDir); + .createReverseIndex(new FakeProcessHeartbeat(), "name", workDir); } private void createPrioReverseIndex() throws SQLException, IOException { @@ -255,7 +255,7 @@ public class IndexQueryServiceIntegrationSmokeTest { if (!Files.isDirectory(tmpDir)) Files.createDirectories(tmpDir); new ReverseIndexConstructor(outputFileDocs, outputFileWords, IndexJournalReader::singleFile, DocIdRewriter.identity(), tmpDir) - .createReverseIndex(new FakeProcessHeartbeat(), workDir); + .createReverseIndex(new FakeProcessHeartbeat(), "name", workDir); } private void createForwardIndex() throws SQLException, IOException { diff --git a/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationTest.java b/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationTest.java index b35d9406..67349b4e 100644 --- a/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationTest.java +++ b/code/services-core/index-service/src/test/java/nu/marginalia/index/svc/IndexQueryServiceIntegrationTest.java @@ -495,7 +495,7 @@ public class IndexQueryServiceIntegrationTest { if (!Files.isDirectory(tmpDir)) Files.createDirectories(tmpDir); new ReverseIndexConstructor(outputFileDocs, outputFileWords, IndexJournalReader::singleFile, DocIdRewriter.identity(), tmpDir) - .createReverseIndex(new FakeProcessHeartbeat(), workDir); + .createReverseIndex(new FakeProcessHeartbeat(), "name", workDir); } private void createPrioReverseIndex() throws SQLException, IOException { @@ -508,7 +508,7 @@ public class IndexQueryServiceIntegrationTest { if (!Files.isDirectory(tmpDir)) Files.createDirectories(tmpDir); new ReverseIndexConstructor(outputFileDocs, outputFileWords, IndexJournalReader::singleFile, DocIdRewriter.identity(), tmpDir) - .createReverseIndex(new FakeProcessHeartbeat(), workDir); + .createReverseIndex(new FakeProcessHeartbeat(), "name", workDir); } private void createForwardIndex() throws SQLException, IOException {