diff --git a/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/management/UnindexServlet.java b/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/management/UnindexServlet.java index 55143ecfb..02e14f824 100644 --- a/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/management/UnindexServlet.java +++ b/dicoogle/src/main/java/pt/ua/dicoogle/server/web/servlets/management/UnindexServlet.java @@ -121,8 +121,8 @@ protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws S for (Task task: tasks) { try { UnindexReport report = task.get(); - indexed = uris.size() - report.errorCount(); - failed = report.getUnindexFailures().size(); + indexed = uris.size() - report.notUnindexedFileCount(); + failed = report.failedFileCount(); notfound = report.getNotFound().size(); } catch (Exception ex) { logger.error("Task to unindex items in {} failed", providers.get(i), ex); diff --git a/sdk/src/main/java/pt/ua/dicoogle/sdk/datastructs/UnindexReport.java b/sdk/src/main/java/pt/ua/dicoogle/sdk/datastructs/UnindexReport.java index 2e9109f86..34ebcc952 100644 --- a/sdk/src/main/java/pt/ua/dicoogle/sdk/datastructs/UnindexReport.java +++ b/sdk/src/main/java/pt/ua/dicoogle/sdk/datastructs/UnindexReport.java @@ -130,10 +130,30 @@ public Collection getNotFound() { return Collections.unmodifiableCollection(this.notFound); } - /** Returns the total count of errors reported during unindexing - * due to either not having been found or other failures. + /** Returns the total count of failures reported during unindexing. + * + * Note that this does not necessarily correspond to + * the number of files affected, + * and does not include files which were not found. + */ + public long failureCount() { + return this.failures.size(); + } + + /** Returns the total count of files which were not unindexed, + * whether because they were not found + * or could not be unindexed for other reasons. + */ + public long notUnindexedFileCount() { + return this.notFound.size() + failedFileCount(); + } + + /** Returns the total count of files which failed to unindexed + * for reasons other than the files not being found. */ - public long errorCount() { - return this.failures.size() + this.notFound.size(); + public long failedFileCount() { + return this.failures.stream() + .mapToLong(f -> f.urisAffected.size()) + .sum(); } }