From d04966349db54b4b17ea8f3873298d2f92b15ad5 Mon Sep 17 00:00:00 2001 From: Mitch Miller Date: Mon, 6 Nov 2023 09:11:46 -0500 Subject: [PATCH 1/2] Corrected (staging area) match count facet to give the total number of unique GSRS records that match a staging area record --- .../MetadataMatchCountIndexValueMaker.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java b/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java index 3d0cddd7..0e7a2c25 100644 --- a/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java +++ b/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java @@ -11,9 +11,12 @@ import ix.core.search.text.IndexableValue; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; +import scala.collection.immutable.List; import java.lang.reflect.InvocationTargetException; import java.util.Collection; +import java.util.HashSet; +import java.util.Set; import java.util.function.Consumer; @Slf4j @@ -53,13 +56,16 @@ public void createIndexableValues(ImportMetadata importMetadata, Consumerm. getSourceName().equals(USED_SOURCE)) + + long matchCount=matchedRecordSummary.getMatches().stream() + .flatMap(m->m.getMatchingRecords().stream()) + .filter(r->r.getSourceName().equals(USED_SOURCE)) + .map(r->r.getRecordId()) + .distinct() .count(); consumer.accept(IndexableValue.simpleFacetStringValue(IMPORT_METADATA_MATCH_COUNT_FACET, Long.toString(matchCount))); log.trace("created string facet {} with value {}", IMPORT_METADATA_MATCH_COUNT_FACET, matchCount); + matchedRecordSummary.getMatches().stream() .filter(m->m.getMatchingRecords().stream().anyMatch(r->r.getSourceName().equals(USED_SOURCE))) .forEach(r->r.getMatchingRecords() From 8e8001c1494efd2b44a410796f41e0148d0752e0 Mon Sep 17 00:00:00 2001 From: Mitch Miller Date: Mon, 6 Nov 2023 09:54:05 -0500 Subject: [PATCH 2/2] Removed unused imports --- .../imports/indexers/MetadataMatchCountIndexValueMaker.java | 5 ----- 1 file changed, 5 deletions(-) diff --git a/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java b/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java index 0e7a2c25..a46f4ae8 100644 --- a/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java +++ b/gsrs-spring-boot-autoconfigure/src/main/java/gsrs/imports/indexers/MetadataMatchCountIndexValueMaker.java @@ -3,7 +3,6 @@ import gsrs.config.EntityContextLookup; import gsrs.imports.GsrsImportAdapterFactoryFactory; import gsrs.stagingarea.model.ImportMetadata; -import gsrs.stagingarea.model.MatchedKeyValue; import gsrs.stagingarea.model.MatchedRecordSummary; import gsrs.stagingarea.repository.ImportDataRepository; import gsrs.stagingarea.service.StagingAreaService; @@ -11,12 +10,8 @@ import ix.core.search.text.IndexableValue; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; -import scala.collection.immutable.List; import java.lang.reflect.InvocationTargetException; -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; import java.util.function.Consumer; @Slf4j