Skip to content

Commit

Permalink
#644 facets were returning results from deleted descriptor groups
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Jan 8, 2025
1 parent 492028e commit 0c2eada
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@
LEFT JOIN address ma ON ma.key = c.mailing_address_key
</if>
<if test="params.descriptorFacet">
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key AND cdg.deleted IS NULL
INNER JOIN collection_descriptor cd ON cd.collection_descriptor_group_key = cdg.key
</if>
<include refid="org.gbif.registry.persistence.mapper.collections.CollectionMapper.LIST_FILTER"/>
Expand Down Expand Up @@ -621,7 +621,7 @@
COUNT(DISTINCT CASE WHEN a.${params.facet.name} is not null THEN a.${params.facet.name} ELSE ma.${params.facet.name} END)
FROM collection c
<if test="params.descriptorFacet">
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key AND cdg.deleted IS NULL
INNER JOIN collection_descriptor cd ON cd.collection_descriptor_group_key = cdg.key
</if>
</when>
Expand All @@ -632,7 +632,7 @@
COUNT(DISTINCT facet)
FROM collection c
<if test="params.descriptorFacet">
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key AND cdg.deleted IS NULL
INNER JOIN collection_descriptor cd ON cd.collection_descriptor_group_key = cdg.key
</if>
INNER JOIN unnest(
Expand Down Expand Up @@ -691,7 +691,7 @@
</choose>
) FROM collection c
<if test="params.descriptorFacet">
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key
INNER JOIN collection_descriptor_group cdg ON cdg.collection_key = c.key AND cdg.deleted IS NULL
INNER JOIN collection_descriptor cd ON cd.collection_descriptor_group_key = cdg.key
</if>
</otherwise>
Expand Down

0 comments on commit 0c2eada

Please sign in to comment.