diff --git a/turing-app/src/main/java/com/viglet/turing/api/sn/console/TurSNSiteFieldExtAPI.java b/turing-app/src/main/java/com/viglet/turing/api/sn/console/TurSNSiteFieldExtAPI.java index a487c3004a..1ff9961adb 100644 --- a/turing-app/src/main/java/com/viglet/turing/api/sn/console/TurSNSiteFieldExtAPI.java +++ b/turing-app/src/main/java/com/viglet/turing/api/sn/console/TurSNSiteFieldExtAPI.java @@ -198,6 +198,7 @@ private TurSNSiteFieldExt saveSNSiteFieldExt(TurSNSite turSNSite, TurSNSiteField .facetType(TurSNSiteFacetFieldEnum.DEFAULT) .facetItemType(TurSNSiteFacetFieldEnum.DEFAULT) .facetSort(TurSNSiteFacetFieldSortEnum.COUNT) + .showAllFacetItems(false) .secondaryFacet(false) .hl(0) .multiValued(turSNSiteField.getMultiValued()) @@ -222,6 +223,7 @@ private void addTurSNSiteFieldExt(TurSNFieldType turSNFieldType, TurSNSite turSN .facetItemType(TurSNSiteFacetFieldEnum.DEFAULT) .facetSort(TurSNSiteFacetFieldSortEnum.COUNT) .secondaryFacet(false) + .showAllFacetItems(false) .hl(0) .multiValued(1) .facetPosition(0) @@ -258,6 +260,7 @@ public TurSNSiteFieldExt turSNSiteFieldExtUpdate(@PathVariable String ignoredSnS turSNSiteFieldExtEdit.setFacetType(turSNSiteFieldExt.getFacetType()); turSNSiteFieldExtEdit.setFacetItemType(turSNSiteFieldExt.getFacetItemType()); turSNSiteFieldExtEdit.setSecondaryFacet(turSNSiteFieldExt.getSecondaryFacet()); + turSNSiteFieldExtEdit.setShowAllFacetItems(turSNSiteFieldExt.getShowAllFacetItems()); turSNSiteFieldExtEdit.setHl(turSNSiteFieldExt.getHl()); turSNSiteFieldExtEdit.setEnabled(turSNSiteFieldExt.getEnabled()); turSNSiteFieldExtEdit.setMlt(turSNSiteFieldExt.getMlt()); diff --git a/turing-app/src/main/java/com/viglet/turing/persistence/dto/sn/field/TurSNSiteFieldExtDto.java b/turing-app/src/main/java/com/viglet/turing/persistence/dto/sn/field/TurSNSiteFieldExtDto.java index e2ac192943..5ba0bfdd9e 100644 --- a/turing-app/src/main/java/com/viglet/turing/persistence/dto/sn/field/TurSNSiteFieldExtDto.java +++ b/turing-app/src/main/java/com/viglet/turing/persistence/dto/sn/field/TurSNSiteFieldExtDto.java @@ -23,9 +23,12 @@ import com.viglet.turing.commons.se.field.TurSEFieldType; import com.viglet.turing.persistence.model.sn.TurSNSite; +import com.viglet.turing.persistence.model.sn.TurSNSiteFacetRangeEnum; +import com.viglet.turing.persistence.model.sn.field.TurSNSiteFacetFieldEnum; import com.viglet.turing.persistence.model.sn.field.TurSNSiteFieldExt; import com.viglet.turing.persistence.model.sn.field.TurSNSiteFieldExtFacet; import com.viglet.turing.sn.TurSNFieldType; +import jakarta.persistence.Column; import lombok.*; import lombok.experimental.Tolerate; @@ -53,7 +56,11 @@ public class TurSNSiteFieldExtDto { private TurSEFieldType type; private int multiValued; private int facet; + private TurSNSiteFacetRangeEnum facetRange; + private TurSNSiteFacetFieldEnum facetType; + private TurSNSiteFacetFieldEnum facetItemType; private Boolean secondaryFacet; + private Boolean showAllFacetItems; private int hl; private int mlt; private int enabled; @@ -73,12 +80,16 @@ public TurSNSiteFieldExtDto(TurSNSiteFieldExt turSNSiteFieldExt) { this.externalId = turSNSiteFieldExt.getExternalId(); this.name = turSNSiteFieldExt.getName(); this.description = turSNSiteFieldExt.getDescription(); + this.facet = turSNSiteFieldExt.getFacet(); + this.facetRange = turSNSiteFieldExt.getFacetRange(); this.facetName = turSNSiteFieldExt.getFacetName(); + this.facetType = turSNSiteFieldExt.getFacetType(); + this.facetItemType = turSNSiteFieldExt.getFacetItemType(); + this.secondaryFacet = turSNSiteFieldExt.getSecondaryFacet(); + this.showAllFacetItems = turSNSiteFieldExt.getShowAllFacetItems(); this.snType = turSNSiteFieldExt.getSnType(); this.type = turSNSiteFieldExt.getType(); this.multiValued = turSNSiteFieldExt.getMultiValued(); - this.facet = turSNSiteFieldExt.getFacet(); - this.secondaryFacet = turSNSiteFieldExt.getSecondaryFacet(); this.hl = turSNSiteFieldExt.getHl(); this.mlt = turSNSiteFieldExt.getMlt(); this.enabled = turSNSiteFieldExt.getEnabled(); diff --git a/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/field/TurSNSiteFieldExt.java b/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/field/TurSNSiteFieldExt.java index 8d2aad904d..ce7f3d71ca 100644 --- a/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/field/TurSNSiteFieldExt.java +++ b/turing-app/src/main/java/com/viglet/turing/persistence/model/sn/field/TurSNSiteFieldExt.java @@ -86,6 +86,8 @@ public class TurSNSiteFieldExt implements Serializable { private Integer facetPosition; @Column private Boolean secondaryFacet; + @Column + private Boolean showAllFacetItems; @Column(nullable = false) private TurSNFieldType snType; @Column(nullable = false) diff --git a/turing-app/src/main/java/com/viglet/turing/persistence/repository/sn/field/TurSNSiteFieldExtRepository.java b/turing-app/src/main/java/com/viglet/turing/persistence/repository/sn/field/TurSNSiteFieldExtRepository.java index cd32daaf0b..1b4ec4e4da 100644 --- a/turing-app/src/main/java/com/viglet/turing/persistence/repository/sn/field/TurSNSiteFieldExtRepository.java +++ b/turing-app/src/main/java/com/viglet/turing/persistence/repository/sn/field/TurSNSiteFieldExtRepository.java @@ -37,73 +37,87 @@ public interface TurSNSiteFieldExtRepository extends JpaRepository { - @Cacheable("turSNSiteFieldExtFindByTurSNSite") + String FIND_BY_TUR_SN_SITE = "turSNSiteFieldExtFindByTurSNSite"; + String FIND_BY_TUR_SN_SITE_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndFacetAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndSecondaryFacetAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION = "findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition"; + String FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE = "findByTurSNSiteAndFacetAndEnabledAndType"; + String FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndHlAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndMltAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndRequiredAndEnabled"; + String FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED = "turSNSiteFieldExtFindByTurSNSiteAndNlpAndEnabled"; + + @Cacheable(FIND_BY_TUR_SN_SITE) List findByTurSNSite(Sort sort, TurSNSite turSNSite); - @Cacheable("turSNSiteFieldExtFindByTurSNSiteAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_ENABLED) List findByTurSNSiteAndEnabled(TurSNSite turSNSite, int enabled); - @Cacheable("turSNSiteFieldExtFindByTurSNSiteAndFacetAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED) List findByTurSNSiteAndFacetAndEnabled(TurSNSite turSNSite, int facet, int enabled); - @Cacheable("turSNSiteFieldExtFindByTurSNSiteAndSecondaryFacetAndEnabled(") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED) List findByTurSNSiteAndSecondaryFacetAndEnabled(TurSNSite turSNSite, Boolean secondaryFacet, int enabled); - @Cacheable("findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION) List findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition(TurSNSite turSNSite, int facet, int enabled); - @Cacheable("findByTurSNSiteAndFacetAndEnabledAndType") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE) List findByTurSNSiteAndFacetAndEnabledAndType(TurSNSite turSNSite, int facet, int enabled, TurSEFieldType type); - @Cacheable("turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED) List findByTurSNSiteAndHlAndEnabled(TurSNSite turSNSite, int hl, int enabled); - @Cacheable("turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED) List findByTurSNSiteAndMltAndEnabled(TurSNSite turSNSite, int mlt, int enabled); - @Cacheable("turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED) List findByTurSNSiteAndRequiredAndEnabled(TurSNSite turSNSite, int required, int enabled); - @Cacheable("turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled") + @Cacheable(FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED) List findByTurSNSiteAndNlpAndEnabled(TurSNSite turSNSite, int nlp, int enabled); - List findByTurSNSiteAndName(TurSNSite turSNSite, String name); - boolean existsByTurSNSiteAndName(TurSNSite turSNSite, String name); @Query("SELECT MAX(t.facetPosition) FROM TurSNSiteFieldExt t") Optional findMaxFacetPosition(); - @CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType", - "findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition" }, allEntries = true) + @CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION, + FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true) @NotNull TurSNSiteFieldExt save(@NotNull TurSNSiteFieldExt turSNSiteFieldExt); - @CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType", - "findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition"}, allEntries = true) + @CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION, + FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true) void delete(@NotNull TurSNSiteFieldExt turSNSiteFieldExt); @Modifying @Query("delete from TurSNSiteFieldExt ssfe where ssfe.id = ?1") - @CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled" }, allEntries = true) + @CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION, + FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true) void delete(String turSnSiteFieldId); @Modifying @Query("delete from TurSNSiteFieldExt ssfe where ssfe.turSNSite= ?1 and ssfe.snType = ?2") - @CacheEvict(value = { "turSNSiteFieldExtfindByTurSNSite", "turSNSiteFieldExtfindByTurSNSiteAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndFacetAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndHlAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndMltAndEnabled", "turSNSiteFieldExtfindByTurSNSiteAndRequiredAndEnabled", - "turSNSiteFieldExtfindByTurSNSiteAndNlpAndEnabled", "findByTurSNSiteAndFacetAndEnabledAndType", - "findByTurSNSiteAndFacetAndEnabledOrderByFacetPosition"}, allEntries = true) + @CacheEvict(value = {FIND_BY_TUR_SN_SITE, FIND_BY_TUR_SN_SITE_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_HL_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_MLT_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_REQUIRED_AND_ENABLED, + FIND_BY_TUR_SN_SITE_AND_NLP_AND_ENABLED, FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_AND_TYPE, + FIND_BY_TUR_SN_SITE_AND_FACET_AND_ENABLED_ORDER_BY_FACET_POSITION, + FIND_BY_TUR_SN_SITE_AND_SECONDARY_FACET_AND_ENABLED}, allEntries = true) void deleteByTurSNSiteAndSnType(TurSNSite turSNSite, TurSNFieldType turSNFieldType); } diff --git a/turing-app/src/main/java/com/viglet/turing/sn/TurSNSearchProcess.java b/turing-app/src/main/java/com/viglet/turing/sn/TurSNSearchProcess.java index 80e7538da9..41718aebe8 100644 --- a/turing-app/src/main/java/com/viglet/turing/sn/TurSNSearchProcess.java +++ b/turing-app/src/main/java/com/viglet/turing/sn/TurSNSearchProcess.java @@ -79,6 +79,7 @@ public class TurSNSearchProcess { public static final String LANGUAGE = "language"; public static final String FACETS_TO_REMOVE = "Facets To Remove"; public static final String AND_OR = "AND-OR"; + public static final String FACET_ITEM_AND = "-AND"; private final TurSNSiteFieldExtRepository turSNSiteFieldExtRepository; private final TurSNSiteFieldExtFacetRepository turSNSiteFieldExtFacetRepository; private final TurSNSiteRepository turSNSiteRepository; @@ -522,16 +523,19 @@ private List responseFacet(TurSNSiteSearchContext cont Map facetMap, TurSEResults turSEResults) { if (facetIsEnabled(turSNSite, turSEResults)) { - TurSNFacetTypeContext turSNFacetTypeContext = new TurSNFacetTypeContext(null, turSNSite, - context.getTurSEParameters().getFilterQueries()); - FacetResult result = getFacetResult(context, turSolrInstance, turSEResults, turSNFacetTypeContext, - turSolr.getFacetsInFilterQuery(turSNFacetTypeContext)); List turSNSiteSearchFacetBeans = new ArrayList<>(); turSEResults.getFacetResults() .stream().filter(f -> showMainFacet(facetsInFilterQueries, facetMap, f, turSNSite)) - .forEach(facet -> getFacetResponse(context, facetMap, facet, result.usedFacetItems(), - result.facetTypeAndFacetItemTypeValues(), - turSNSiteSearchFacetBeans)); + .forEach(facet -> { + if (facetMap.containsKey(facet.getFacet())) { + TurSNFacetTypeContext turSNFacetTypeContext = + new TurSNFacetTypeContext(facetMap.get(facet.getFacet()), turSNSite, + context.getTurSEParameters().getFilterQueries()); + getFacetResponse(context, facetMap, getFacetResult(context, turSolrInstance, turSEResults, turSNFacetTypeContext, + turSolr.getFacetsInFilterQuery(turSNFacetTypeContext)), + turSNSiteSearchFacetBeans); + } + }); return turSNSiteSearchFacetBeans; } return Collections.emptyList(); @@ -549,16 +553,19 @@ private List responseSecondaryFacet(TurSNSiteSearchCon Map facetMap, TurSEResults turSEResults) { if (facetIsEnabled(turSNSite, turSEResults)) { - TurSNFacetTypeContext turSNFacetTypeContext = new TurSNFacetTypeContext(null, turSNSite, - context.getTurSEParameters().getFilterQueries()); - FacetResult facetResult = getFacetResult(context, turSolrInstance, turSEResults, turSNFacetTypeContext, - turSolr.getSecondaryFacetsInFilterQuery(turSNFacetTypeContext)); List turSNSiteSearchFacetBeans = new ArrayList<>(); turSEResults.getFacetResults() .stream().filter(f -> showSecondaryFacet(facetsInFilterQueries, facetMap, f, turSNSite)) - .forEach(facet -> getFacetResponse(context, facetMap, facet, facetResult.usedFacetItems(), - facetResult.facetTypeAndFacetItemTypeValues(), - turSNSiteSearchFacetBeans)); + .forEach(facet -> { + if (facetMap.containsKey(facet.getFacet())) { + TurSNFacetTypeContext turSNFacetTypeContext = + new TurSNFacetTypeContext(facetMap.get(facet.getFacet()), turSNSite, + context.getTurSEParameters().getFilterQueries()); + getFacetResponse(context, facetMap, getFacetResult(context, turSolrInstance, turSEResults, turSNFacetTypeContext, + turSolr.getSecondaryFacetsInFilterQuery(turSNFacetTypeContext)), + turSNSiteSearchFacetBeans); + } + }); return turSNSiteSearchFacetBeans; } return Collections.emptyList(); @@ -567,79 +574,115 @@ private List responseSecondaryFacet(TurSNSiteSearchCon @NotNull private FacetResult getFacetResult(TurSNSiteSearchContext context, TurSolrInstance turSolrInstance, TurSEResults turSEResults, TurSNFacetTypeContext turSNFacetTypeContext, - List secondaryFacetsInFilterQuery) { + List facetsInFilterQuery) { + String facetName = turSNFacetTypeContext.getTurSNSiteFacetFieldExtDto().getName(); + List usedFacetItems = Optional.ofNullable(context.getTurSEParameters()) .map(TurSEParameters::getFilterQueries) .map(TurSEFilterQueryParameters::getFq) .orElse(Collections.emptyList()); String facetTypeAndFacetItemTypeValues = TurSolr.getFacetTypeAndFacetItemTypeValues(turSNFacetTypeContext); - if (facetTypeAndFacetItemTypeValues.equals(AND_OR)) { - secondaryFacetsInFilterQuery.forEach(facet -> { - TurSNSiteSearchContext contextSearchFacet = SerializationUtils.clone(context); - if (turSolr.getFqFields(turSNFacetTypeContext - .getQueryParameters()).contains(secondaryFacetsInFilterQuery.getFirst())) { - contextSearchFacet.getTurSEParameters().getFilterQueries() - .setFq(contextSearchFacet.getTurSEParameters() - .getFilterQueries().getFq().stream() - .filter(fq -> !fq.startsWith(facet)) - .toList()); - contextSearchFacet.getTurSEParameters().setRows(-1); - turSolr.retrieveSolrFromSN(turSolrInstance, contextSearchFacet).ifPresent(turSEFacetResults -> - turSEResults.setFacetResults(turSEResults.getFacetResults().stream() - .map(f -> { - if (f.getFacet().equals(facet)) { - return turSEFacetResults.getFacetResults().stream() - .filter(ff -> ff.getFacet().equals(facet)) - .findFirst().orElse(f); - } - return f; - }) - .toList() - )); - } - }); + + if (facetsInFilterQuery != null && + !facetsInFilterQuery.isEmpty() && + facetTypeAndFacetItemTypeValues.equals(AND_OR) && + turSolr.getFqFields(turSNFacetTypeContext + .getQueryParameters()).contains(facetsInFilterQuery.getFirst())) { + TurSNSiteSearchContext contextSearchFacet = SerializationUtils.clone(context); + contextSearchFacet.getTurSEParameters().getFilterQueries() + .setFq(contextSearchFacet.getTurSEParameters() + .getFilterQueries().getFq().stream() + .filter(fq -> !fq.startsWith(facetName)) + .toList()); + contextSearchFacet.getTurSEParameters().setRows(-1); + TurSEFacetResult turSEFacetResult = turSolr.retrieveSolrFromSN(turSolrInstance, contextSearchFacet) + .map(turSEFacetResults -> + turSEFacetResults.getFacetResults().stream() + .filter(ff -> ff.getFacet().equals(facetName)) + .findFirst() + .orElseGet(() -> getTurSEFacetResultDefault(turSEResults, facetName)) + ) + .orElseGet(() -> getTurSEFacetResultDefault(turSEResults, facetName)); + + return new FacetResult(usedFacetItems, facetTypeAndFacetItemTypeValues, turSEFacetResult); } - return new FacetResult(usedFacetItems, facetTypeAndFacetItemTypeValues); + TurSEFacetResult turSEFacetResult = getTurSEFacetResultDefault(turSEResults, + facetName); + return new FacetResult(usedFacetItems, facetTypeAndFacetItemTypeValues, turSEFacetResult); + } - private record FacetResult(List usedFacetItems, String facetTypeAndFacetItemTypeValues) { + @NotNull + private static TurSEFacetResult getTurSEFacetResultDefault(TurSEResults turSEResults, String facet) { + return turSEResults.getFacetResults().stream() + .filter(ff -> ff.getFacet().equals(facet)) + .findFirst().orElse(new TurSEFacetResult()); + } + + private record FacetResult(List usedFacetItems, String facetTypeAndFacetItemTypeValues, + TurSEFacetResult turSEFacetResult) { } private static void getFacetResponse(TurSNSiteSearchContext context, Map facetMap, - TurSEFacetResult facet, List usedFacetItems, - String facetTypeAndFacetItemTypeValues, + FacetResult facetResult, List turSNSiteSearchFacetBeans) { List turSNSiteSearchFacetItemBeans = new ArrayList<>(); + if (facetMap.containsKey(facetResult.turSEFacetResult.getFacet())) { + + TurSNSiteFieldExtDto turSNSiteFieldExtDto = facetMap.get(facetResult.turSEFacetResult.getFacet()); + boolean showAllFacetItems = turSNSiteFieldExtDto.getShowAllFacetItems() != null && + turSNSiteFieldExtDto.getShowAllFacetItems(); + facetResult.turSEFacetResult.getTurSEFacetResultAttr().values().forEach(facetItem -> { + final String fq = facetResult.turSEFacetResult.getFacet() + ":" + facetItem.getAttribute(); + if (showAllFacetItems || facetItem.getCount() > 0 || + (facetResult.usedFacetItems.contains(fq) && + facetResult.facetTypeAndFacetItemTypeValues.equals(AND_OR)) + ) { + boolean selected = facetResult.usedFacetItems.contains(fq); + turSNSiteSearchFacetItemBeans.add(new TurSNSiteSearchFacetItemBean() + .setCount(facetItem.getCount()) + .setLabel(facetItem.getAttribute()) + .setSelected(selected) + .setLink(getLink(context, selected, fq, + facetResult.facetTypeAndFacetItemTypeValues, turSNSiteFieldExtDto))); - // Facet Item Loop - facet.getTurSEFacetResultAttr().values().forEach(facetItem -> { - final String fq = facet.getFacet() + ":" + facetItem.getAttribute(); - if (facetItem.getCount() > 0 || - usedFacetItems.contains(fq) && facetTypeAndFacetItemTypeValues.equals(AND_OR)) { - boolean selected = usedFacetItems.contains(fq); - turSNSiteSearchFacetItemBeans.add(new TurSNSiteSearchFacetItemBean() - .setCount(facetItem.getCount()) - .setLabel(facetItem.getAttribute()) - .setSelected(selected) - .setLink(getLink(context, selected, fq))); + } + } + ); + if (!turSNSiteSearchFacetItemBeans.isEmpty()) { + turSNSiteSearchFacetBeans.add(getTurSNSiteSearchFacetBean(context, turSNSiteFieldExtDto, + turSNSiteSearchFacetItemBeans)); } - }); - if (!turSNSiteSearchFacetItemBeans.isEmpty()) { - turSNSiteSearchFacetBeans.add(getTurSNSiteSearchFacetBean(context, - facetMap.get(facet.getFacet()), - turSNSiteSearchFacetItemBeans)); } + } - private static String getLink(TurSNSiteSearchContext context, boolean selected, String fq) { - return selected ? - TurSNUtils + private static String getLink(TurSNSiteSearchContext context, boolean selected, String fq, + String facetTypeAndFacetItemTypeValues, TurSNSiteFieldExtDto turSNSiteFieldExtDto ) { + if (facetTypeAndFacetItemTypeValues.endsWith(FACET_ITEM_AND)) { + if (selected) { + return TurSNUtils .removeFilterQuery(context.getUri(), fq) - .toString() : - TurSNUtils - .addFilterQuery(context.getUri(), fq) .toString(); + } + else { + URI uri = TurSNUtils.removeFilterQueryByFieldName(context.getUri(), + turSNSiteFieldExtDto.getName()); + return TurSNUtils + .addFilterQuery(uri, fq) + .toString(); + } + } + else { + return selected ? + TurSNUtils + .removeFilterQuery(context.getUri(), fq) + .toString() : + TurSNUtils + .addFilterQuery(context.getUri(), fq) + .toString(); + } } private List responsePagination(URI uri, TurSEGenericResults turSEResults) { diff --git a/turing-app/src/main/java/com/viglet/turing/sn/facet/TurSNFacetTypeContext.java b/turing-app/src/main/java/com/viglet/turing/sn/facet/TurSNFacetTypeContext.java index 76cd445f4c..94d7bf3e24 100644 --- a/turing-app/src/main/java/com/viglet/turing/sn/facet/TurSNFacetTypeContext.java +++ b/turing-app/src/main/java/com/viglet/turing/sn/facet/TurSNFacetTypeContext.java @@ -19,6 +19,7 @@ package com.viglet.turing.sn.facet; import com.viglet.turing.commons.se.TurSEFilterQueryParameters; +import com.viglet.turing.persistence.dto.sn.field.TurSNSiteFieldExtDto; import com.viglet.turing.persistence.model.sn.TurSNSite; import com.viglet.turing.persistence.model.sn.field.TurSNSiteFieldExt; import lombok.AllArgsConstructor; @@ -33,17 +34,17 @@ @Getter @Setter public class TurSNFacetTypeContext { - private TurSNSiteFieldExt turSNSiteFacetFieldExt; + private TurSNSiteFieldExtDto turSNSiteFacetFieldExtDto; private TurSNSite turSNSite; private TurSEFilterQueryParameters queryParameters; public TurSNFacetTypeContext(TurSNSite turSNSite, TurSEFilterQueryParameters queryParameters) { - this.turSNSiteFacetFieldExt = null; + this.turSNSiteFacetFieldExtDto = null; this.turSNSite = turSNSite; this.queryParameters = queryParameters; } public boolean isSpecificField() { - return turSNSiteFacetFieldExt != null; + return turSNSiteFacetFieldExtDto != null; } } diff --git a/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java b/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java index 2c57b74823..3f19c18345 100644 --- a/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java +++ b/turing-app/src/main/java/com/viglet/turing/solr/TurSolr.java @@ -31,6 +31,7 @@ import com.viglet.turing.commons.sn.search.TurSNFilterQueryOperator; import com.viglet.turing.commons.sn.search.TurSNSiteSearchContext; import com.viglet.turing.commons.utils.TurCommonsUtils; +import com.viglet.turing.persistence.dto.sn.field.TurSNSiteFieldExtDto; import com.viglet.turing.persistence.model.sn.TurSNSite; import com.viglet.turing.persistence.model.sn.TurSNSiteFacetRangeEnum; import com.viglet.turing.persistence.model.sn.TurSNSiteFacetSortEnum; @@ -895,8 +896,10 @@ private static void addEnabledFacetItem(TurSNSiteFacetFieldEnum facetType, Strin .filter(facet -> facet.getName().equals(kv.getKey())) .findFirst()) .ifPresentOrElse(facet -> + { - TurSNFacetTypeContext context = new TurSNFacetTypeContext(facet, turSNSite, + TurSNFacetTypeContext context = new TurSNFacetTypeContext( + new TurSNSiteFieldExtDto(facet), turSNSite, filterQueryParameters); if (isFacetTypeDefault(facetType)) { addEnabledFacetItem(facet.getName(), getFacetType(context), @@ -1084,7 +1087,7 @@ private static String getFacetTypeConditionInFilterQuery(TurSNFacetTypeContext c } private static TurSNSiteFacetFieldEnum getFacetItemType(TurSNFacetTypeContext context) { - return Optional.ofNullable(context.getTurSNSiteFacetFieldExt()).map(field -> { + return Optional.ofNullable(context.getTurSNSiteFacetFieldExtDto()).map(field -> { TurSNSiteFacetFieldEnum facetItemType = field.getFacetItemType(); if (context.isSpecificField() && facetItemType != null && !isFacetTypeDefault(facetItemType)) { return facetItemType; @@ -1092,11 +1095,13 @@ private static TurSNSiteFacetFieldEnum getFacetItemType(TurSNFacetTypeContext co return getFacetItemTypeFromSite(context.getTurSNSite()); } }) - .orElseGet(() -> getFacetItemTypeFromSite(context.getTurSNSite())); + .orElseGet(() -> { + return getFacetItemTypeFromSite(context.getTurSNSite()); + }); } private static TurSNSiteFacetFieldEnum getFacetType(TurSNFacetTypeContext context) { - return Optional.ofNullable(context.getTurSNSiteFacetFieldExt()).map(field -> { + return Optional.ofNullable(context.getTurSNSiteFacetFieldExtDto()).map(field -> { TurSNSiteFacetFieldEnum facetType = field.getFacetType(); TurSNFilterQueryOperator operator = context.getQueryParameters().getOperator(); if (operatorIsNotEmpty(operator)) { @@ -1157,7 +1162,7 @@ private String setFacetTypeConditionInFacet(TurSNFacetTypeContext context, Strin return FACET_OR.concat(query); } case OR_AND -> { - if (!fqFields.contains(context.getTurSNSiteFacetFieldExt().getName())) { + if (!fqFields.contains(context.getTurSNSiteFacetFieldExtDto().getName())) { return FACET_OR.concat(query); } else { return query; @@ -1233,7 +1238,8 @@ private List prepareQueryFacet(TurSNSite turSNSite, .setFacetLimit(turSNSite.getItemsPerFacet()) .setFacetSort(facetSortIsEmptyOrCount(turSNSite) ? COUNT : INDEX); enabledFacets.forEach(turSNSiteFacetFieldExt -> { - TurSNFacetTypeContext context = new TurSNFacetTypeContext(turSNSiteFacetFieldExt, turSNSite, + TurSNFacetTypeContext context = new TurSNFacetTypeContext(new + TurSNSiteFieldExtDto(turSNSiteFacetFieldExt), turSNSite, queryParameters); setFacetSort(query, turSNSiteFacetFieldExt); if (isDateRangeFacet(turSNSiteFacetFieldExt)) @@ -1271,12 +1277,12 @@ private static boolean facetSortIsEmptyOrCount(TurSNSite turSNSite) { private void addFacetField(TurSNFacetTypeContext context, SolrQuery query) { query.addFacetField(setFacetTypeConditionInFacet(context, - setEntityPrefix(context.getTurSNSiteFacetFieldExt()) - .concat(context.getTurSNSiteFacetFieldExt().getName()))); + setEntityPrefix(context.getTurSNSiteFacetFieldExtDto()) + .concat(context.getTurSNSiteFacetFieldExtDto().getName()))); } private void addFacetRange(TurSNFacetTypeContext context, SolrQuery query) { - String fieldName = context.getTurSNSiteFacetFieldExt().getName(); + String fieldName = context.getTurSNSiteFacetFieldExtDto().getName(); Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); cal.set(Calendar.DAY_OF_MONTH, 1); @@ -1287,7 +1293,7 @@ private void addFacetRange(TurSNFacetTypeContext context, SolrQuery query) { cal.set(Calendar.MILLISECOND, 0); query.set("f." + fieldName + ".facet.range.gap", - PLUS_ONE + context.getTurSNSiteFacetFieldExt().getFacetRange()); + PLUS_ONE + context.getTurSNSiteFacetFieldExtDto().getFacetRange()); query.set("f." + fieldName + ".facet.range.start", solrDateFormatter().format(DateUtils.addYears(cal.getTime(), -100))); query.set("f." + fieldName + ".facet.range.end", @@ -1297,8 +1303,8 @@ private void addFacetRange(TurSNFacetTypeContext context, SolrQuery query) { } @NotNull - private static String setEntityPrefix(TurSNSiteFieldExt turSNSiteFacetFieldExt) { - return isNerOrThesaurus(turSNSiteFacetFieldExt.getSnType()) ? TURING_ENTITY : EMPTY; + private static String setEntityPrefix(TurSNSiteFieldExtDto turSNSiteFacetFieldExtDto) { + return isNerOrThesaurus(turSNSiteFacetFieldExtDto.getSnType()) ? TURING_ENTITY : EMPTY; } private static boolean isNerOrThesaurus(TurSNFieldType snType) { diff --git a/turing-ui/package-lock.json b/turing-ui/package-lock.json index 101e6e6bbb..e480e9242d 100644 --- a/turing-ui/package-lock.json +++ b/turing-ui/package-lock.json @@ -18,7 +18,7 @@ "@angular/platform-browser": "18.2.10", "@angular/platform-browser-dynamic": "18.2.10", "@angular/router": "18.2.10", - "@primer/css": "21.5.0", + "@primer/css": "21.4.0", "@primer/octicons": "19.12.0", "@primer/styled-octicons": "19.12.0", "ace-builds": "^1.36.3", @@ -2888,6 +2888,84 @@ "node": ">=18" } }, + "node_modules/@github/auto-check-element": { + "version": "5.4.2", + "resolved": "https://registry.npmjs.org/@github/auto-check-element/-/auto-check-element-5.4.2.tgz", + "integrity": "sha512-8SU9sI/0LpDOXybZ6juzALHbtwwDpaitaTHwKRIr4uV/AFy4iUG8LsMYE4tYRsj0w0eTlR7+c+S737eveOcKnQ==", + "license": "MIT", + "dependencies": { + "@github/mini-throttle": "^2.1.0" + } + }, + "node_modules/@github/auto-complete-element": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/@github/auto-complete-element/-/auto-complete-element-3.6.2.tgz", + "integrity": "sha512-AgkrawNa2Focapn05yc/mNVTlAOqPFlMPhqkkMygPtOddms6NYxlCuVx8OM6aCTzBeEJlYur+/CS56hk4mvwmA==", + "license": "MIT", + "dependencies": { + "@github/combobox-nav": "^2.1.7" + } + }, + "node_modules/@github/catalyst": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/@github/catalyst/-/catalyst-1.7.0.tgz", + "integrity": "sha512-qOAxrDdRZz9+v4y2WoAfh11rpRY/x4FRofPNmJyZFzAjubtzE3sCa/tAycWWufmQGoYiwwzL/qJBBgyg7avxPw==", + "license": "MIT" + }, + "node_modules/@github/clipboard-copy-element": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/@github/clipboard-copy-element/-/clipboard-copy-element-1.3.0.tgz", + "integrity": "sha512-wyntkQkwoLbLo+Hqg2LIVMXDIzcvUb9bSDz+clX6nVJItwzh103rHxdXFRZD+DmxVbuEW5xSznYQXkz1jZT+xg==", + "license": "MIT" + }, + "node_modules/@github/combobox-nav": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/@github/combobox-nav/-/combobox-nav-2.3.1.tgz", + "integrity": "sha512-gwxPzLw8XKecy1nP63i9lOBritS3bWmxl02UX6G0TwMQZbMem1BCS1tEZgYd3mkrkiDrUMWaX+DbFCuDFo3K+A==", + "license": "MIT" + }, + "node_modules/@github/details-menu-element": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/@github/details-menu-element/-/details-menu-element-1.0.13.tgz", + "integrity": "sha512-gMkii86w/oUP5dq8yOWZn1sgbgtFj3AYETxxtpsqRggZktgd8te4+npAn4Hm+936c/lxmEzXqfjARL/CzGR4+w==", + "license": "MIT" + }, + "node_modules/@github/image-crop-element": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/@github/image-crop-element/-/image-crop-element-5.0.0.tgz", + "integrity": "sha512-Vgm2OwWAs1ESoib/t5sjxsAYo6YTOxxAjWDRxswX7qrqoyCejTZ3hshdo4Ep5e+Mz/GVTZC3rdMtg06dk/eT4g==", + "license": "MIT" + }, + "node_modules/@github/include-fragment-element": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/@github/include-fragment-element/-/include-fragment-element-6.3.0.tgz", + "integrity": "sha512-BJTt8ZE/arsbC9lQtTH8c1hZS0ZigiN+kzH54ffQ6MhHLT83h0OpSdS9NEVocPl2uuO6w3qxnEKTDzUGMQ5rdQ==", + "license": "MIT" + }, + "node_modules/@github/mini-throttle": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/@github/mini-throttle/-/mini-throttle-2.1.1.tgz", + "integrity": "sha512-KtOPaB+FiKJ6jcKm9UKyaM5fPURHGf+xcp+b4Mzoi81hOc6M1sIGpMZMAVbNzfa2lW5+RPGKq888Px0j76OZ/A==", + "license": "MIT" + }, + "node_modules/@github/relative-time-element": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/@github/relative-time-element/-/relative-time-element-4.4.3.tgz", + "integrity": "sha512-EVKokqx9/DdUAZ2l9WVyY51EtRCO2gQWWMvsRIn7r4glJ91q9CXcnILVHZVCpfD52ucXUhUvtYsAjNJ4qP4uIg==", + "license": "MIT" + }, + "node_modules/@github/remote-input-element": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@github/remote-input-element/-/remote-input-element-0.4.0.tgz", + "integrity": "sha512-apsMwsFW24F+w2wzT8oKoBi9lpm6GeFOmtuL+1YwDVmIiwixfHOD3MnEsEOv0RwmHsMdWmIjP9mxWyTWPKZHGg==", + "license": "MIT" + }, + "node_modules/@github/tab-container-element": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/@github/tab-container-element/-/tab-container-element-3.4.0.tgz", + "integrity": "sha512-Yx70pO8A0p7Stnm9knKkUNX8i4bjuwDYZarRkM8JH0Z+ffhpe++oNAPbzGI9GEcGugRHvKuSC6p4YOdoHtTniQ==", + "license": "MIT" + }, "node_modules/@inquirer/checkbox": { "version": "2.4.7", "resolved": "https://registry.npmjs.org/@inquirer/checkbox/-/checkbox-2.4.7.tgz", @@ -3818,6 +3896,12 @@ "node": "^16.13.0 || >=18.0.0" } }, + "node_modules/@oddbird/popover-polyfill": { + "version": "0.4.4", + "resolved": "https://registry.npmjs.org/@oddbird/popover-polyfill/-/popover-polyfill-0.4.4.tgz", + "integrity": "sha512-n9q0ZXYRct6aYmOjjF5E+i5i0RSjVCkoKDJWILzJAkDBk4jmWOAZFjQfExtcAiJa0buX/Lx/CzBdGgiSSAlbrw==", + "license": "BSD-3-Clause" + }, "node_modules/@parcel/watcher": { "version": "2.4.1", "resolved": "https://registry.npmjs.org/@parcel/watcher/-/watcher-2.4.1.tgz", @@ -4111,7 +4195,6 @@ "version": "0.5.2", "resolved": "https://registry.npmjs.org/@prettier/sync/-/sync-0.5.2.tgz", "integrity": "sha512-Yb569su456XNx5BsH/Vyem7xD6g/y9iLmLUzRKM1a/dhU/D7HqqvkAG72znulXlMXztbV0iiu9O5AL8K98TzZQ==", - "peer": true, "dependencies": { "make-synchronized": "^0.2.8" }, @@ -4122,15 +4205,23 @@ "prettier": "*" } }, + "node_modules/@primer/behaviors": { + "version": "1.8.0", + "resolved": "https://registry.npmjs.org/@primer/behaviors/-/behaviors-1.8.0.tgz", + "integrity": "sha512-ZUfhWVY4ZBKc2Fh3fIa2Qwwa3SnOi914lY5wcmN+UNtsBxeXsjWNwpohJbwRwWZm+nJ3C1n9qJFWpHuBlDVU1A==", + "license": "MIT" + }, "node_modules/@primer/css": { - "version": "21.5.0", - "resolved": "https://registry.npmjs.org/@primer/css/-/css-21.5.0.tgz", - "integrity": "sha512-zkvHxWpVcjURujbWaq4YL8R/9g9qkM6275KMXXgNs/T2o8GekUDH6Qx2cpIPVd/AHtwIwDsy4+yjWcNWsuRgkA==", + "version": "21.4.0", + "resolved": "https://registry.npmjs.org/@primer/css/-/css-21.4.0.tgz", + "integrity": "sha512-mBq0F6lvAuPioW30RP1CyvSkW76UpAzZp1HM+5N/cfpwuarYVsCWYkWQlDtJqIsGYNSa1E2GgL17HzzDt4Bofg==", + "license": "MIT", + "dependencies": { + "@primer/primitives": "^9.0.3", + "@primer/view-components": "^0.34.0" + }, "engines": { "node": ">=16.0.0" - }, - "peerDependencies": { - "@primer/primitives": "^9.0.3" } }, "node_modules/@primer/octicons": { @@ -4145,7 +4236,6 @@ "version": "9.1.2", "resolved": "https://registry.npmjs.org/@primer/primitives/-/primitives-9.1.2.tgz", "integrity": "sha512-KecRJpUdIf14J3gVpoyMMJeQD6Sh5kcHk93N5bYch4XGB0GOZP3ypxz+NByMjr/2HHPsRfCCO5EEgNjmeWYUGQ==", - "peer": true, "dependencies": { "@prettier/sync": "^0.5.2", "prettier": "3.3" @@ -4170,6 +4260,26 @@ "styled-components": "4.x || 5.x" } }, + "node_modules/@primer/view-components": { + "version": "0.34.0", + "resolved": "https://registry.npmjs.org/@primer/view-components/-/view-components-0.34.0.tgz", + "integrity": "sha512-ZtIMakgQ8q+wm/1zdN2wjecyK0ctpBIcubdG11lK0vKhys/RBIfB6qSaQC0FuCi5xDso55sRsucH0TxRL+XdDQ==", + "license": "MIT", + "dependencies": { + "@github/auto-check-element": "^5.2.0", + "@github/auto-complete-element": "^3.6.2", + "@github/catalyst": "^1.6.0", + "@github/clipboard-copy-element": "^1.3.0", + "@github/details-menu-element": "^1.0.12", + "@github/image-crop-element": "^5.0.0", + "@github/include-fragment-element": "^6.1.1", + "@github/relative-time-element": "^4.0.0", + "@github/remote-input-element": "^0.4.0", + "@github/tab-container-element": "^3.1.2", + "@oddbird/popover-polyfill": "^0.4.0", + "@primer/behaviors": "^1.3.4" + } + }, "node_modules/@rollup/plugin-json": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-6.1.0.tgz", @@ -10700,7 +10810,6 @@ "version": "0.2.9", "resolved": "https://registry.npmjs.org/make-synchronized/-/make-synchronized-0.2.9.tgz", "integrity": "sha512-4wczOs8SLuEdpEvp3vGo83wh8rjJ78UsIk7DIX5fxdfmfMJGog4bQzxfvOwq7Q3yCHLC4jp1urPHIxRS/A93gA==", - "peer": true, "funding": { "url": "https://github.com/fisker/make-synchronized?sponsor=1" } @@ -12560,7 +12669,6 @@ "version": "3.3.3", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.3.3.tgz", "integrity": "sha512-i2tDNA0O5IrMO757lfrdQZCc2jPNDVntV0m/+4whiDfWaTKfMNgR7Qz0NAeGz/nRqF4m5/6CLzbP4/liHt12Ew==", - "peer": true, "bin": { "prettier": "bin/prettier.cjs" }, diff --git a/turing-ui/package.json b/turing-ui/package.json index ee89b99a49..7627cfb313 100644 --- a/turing-ui/package.json +++ b/turing-ui/package.json @@ -21,7 +21,7 @@ "@angular/platform-browser": "18.2.10", "@angular/platform-browser-dynamic": "18.2.10", "@angular/router": "18.2.10", - "@primer/css": "21.5.0", + "@primer/css": "21.4.0", "@primer/octicons": "19.12.0", "@primer/styled-octicons": "19.12.0", "ace-builds": "^1.36.3", diff --git a/turing-ui/projects/console/src/sn/component/site/field/sn-site-field-page.component.html b/turing-ui/projects/console/src/sn/component/site/field/sn-site-field-page.component.html index db30cf5a9d..c7870add60 100644 --- a/turing-ui/projects/console/src/sn/component/site/field/sn-site-field-page.component.html +++ b/turing-ui/projects/console/src/sn/component/site/field/sn-site-field-page.component.html @@ -194,13 +194,23 @@

Are you absolutely sure?

It will be classified as a secondary facet. It can be used separately from the main facets.

+
+ +

+ Shows all facet items, even if there are no items. +

+
diff --git a/turing-ui/projects/console/src/sn/model/sn-site-field.model.ts b/turing-ui/projects/console/src/sn/model/sn-site-field.model.ts index e0c5c0bffe..526ff76aef 100644 --- a/turing-ui/projects/console/src/sn/model/sn-site-field.model.ts +++ b/turing-ui/projects/console/src/sn/model/sn-site-field.model.ts @@ -19,6 +19,7 @@ export interface TurSNSiteField { facetSort: TurSNSiteFacetFieldSortEnum; facetPosition: number; secondaryFacet: boolean; + showAllFacetItems: boolean; mlt: number; multiValued: number; nlp: number;