There are cases where we avoid checking the deleted flag of bibs as an
optimization that avoids a JOIN in the search query. However, for some
shapes of real-world data, particularly in upgraded instances, deleted
records can slip through. This commit adds an explicit check for the
flag to all search queries.
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Daniel Pearl <dpearl@cwmars.org>
Signed-off-by: Jason Stephenson <jason@sigio.com>
$bre_join = 'INNER JOIN biblio.record_entry bre ON m.source = bre.id AND bre.deleted';
# The above suffices for filters too when the #deleted modifier
# is in use.
- } elsif ($$flat_plan{uses_bre} or !$self->find_modifier('staff')) {
- $bre_join = 'INNER JOIN biblio.record_entry bre ON m.source = bre.id';
+ } else {
+ $bre_join = 'INNER JOIN biblio.record_entry bre ON m.source = bre.id AND NOT bre.deleted';
}
my $desc = 'ASC';
"AND (bre.vis_attr_vector IS NULL OR NOT ( int4range(0,268435455,'[]') @> ANY(bre.vis_attr_vector) ))".
"))";
# We need bre here, regardless
- $bre_join ||= 'INNER JOIN biblio.record_entry bre ON m.source = bre.id';
+ $bre_join ||= 'INNER JOIN biblio.record_entry bre ON m.source = bre.id AND NOT bre.deleted';
}
my $final_b_attr_test;