Fixes bug where a bib that has multiple subfields
meeting one condition of a 2+ field MARC expert
search could end up in the results list even if
it didn't meet the other conditions (currently multi-field
MARC expert searches use implicit 'AND').
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
git-svn-id: svn://svn.open-ils.org/ILS/trunk@19880
dcc99617-32d9-48b4-a31d-
7c20da2025e4
}
my $where = join(' OR ', @wheres);
- push @selects, "SELECT id, record, $rank as sum FROM $search_table WHERE $where";
+ push @selects, "SELECT record, AVG($rank) as sum FROM $search_table WHERE $where GROUP BY record";
}
my $cl_table = asset::copy_location->table;
my $br_table = biblio::record_entry->table;
- my $cj = 'HAVING COUNT(x.id) = ' . scalar(@selects) if ($class_join eq 'AND');
+ my $cj = 'HAVING COUNT(x.record) = ' . scalar(@selects) if ($class_join eq 'AND');
my $search_table =
'(SELECT x.record, sum(x.sum) FROM (('.
join(') UNION ALL (', @selects).