From 9ac7924c5a140db501d02d79810456cd3f77afb2 Mon Sep 17 00:00:00 2001 From: Tyler Peryea Date: Mon, 4 Oct 2021 19:56:57 -0400 Subject: [PATCH] remove self-reference duplicates from check --- .../src/main/resources/gsrs-h2-local.conf | 2 +- .../ix/ginas/utils/validation/ValidationUtils.java | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/gsrs-module-substance-example/src/main/resources/gsrs-h2-local.conf b/gsrs-module-substance-example/src/main/resources/gsrs-h2-local.conf index 5377e4448..546d6d391 100644 --- a/gsrs-module-substance-example/src/main/resources/gsrs-h2-local.conf +++ b/gsrs-module-substance-example/src/main/resources/gsrs-h2-local.conf @@ -3,7 +3,7 @@ ix.h2 { } spring.datasource.url="jdbc:h2:"${ix.h2.base}"/ginas;mv_store=false" -spring.datasource.username=sa +spring.datasource.username="" spring.datasource.password="" spring.datasource.driverClassName=org.h2.Driver spring.jpa.database-platform=org.hibernate.dialect.H2Dialect diff --git a/gsrs-module-substances-core/src/main/java/ix/ginas/utils/validation/ValidationUtils.java b/gsrs-module-substances-core/src/main/java/ix/ginas/utils/validation/ValidationUtils.java index 4316a1f73..b00f4fca0 100644 --- a/gsrs-module-substances-core/src/main/java/ix/ginas/utils/validation/ValidationUtils.java +++ b/gsrs-module-substances-core/src/main/java/ix/ginas/utils/validation/ValidationUtils.java @@ -1799,10 +1799,17 @@ public static List findLayerNDefinitionalDuplicateCandidates(Substanc try { SearchOptions options = new SearchOptions(); SearchResult sr = defHashCalcRequirements.getSubstanceLegacySearchService().search(request.getQuery(), options); + + //this might not be necessary anymore sr.waitForFinish(); - List fut = sr.getMatches(); - List hits = (List) fut.stream() - .map(s -> (Substance) s) + + List fut = sr.getMatches(); + List hits = fut.stream() + .map(s ->(Substance)s) + .filter(ss->{ + //filter out exact matches + return !substance.getOrGenerateUUID().equals(ss.getOrGenerateUUID()); + }) .collect(Collectors.toList()); return hits; } catch (Exception ex) {