[open-ils-commits] r19880 - trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher (gmc)

svn at svn.open-ils.org svn at svn.open-ils.org
Mon Mar 28 22:06:45 EDT 2011


Author: gmc
Date: 2011-03-28 22:06:43 -0400 (Mon, 28 Mar 2011)
New Revision: 19880

Modified:
   trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
Log:
bug 744687: fix multi-field MARC expert search

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 at esilibrary.com>

Modified: trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm	2011-03-28 22:44:05 UTC (rev 19879)
+++ trunk/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/metabib.pm	2011-03-29 02:06:43 UTC (rev 19880)
@@ -458,7 +458,7 @@
 		}
 		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";
 
 	}
 
@@ -475,7 +475,7 @@
 	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).



More information about the open-ils-commits mailing list