[Koha-cvs] koha/C4 SearchMarc.pm

Thomas D koha at alinto.com
Thu Feb 16 04:12:15 CET 2006


CVSROOT:	/sources/koha
Module name:	koha
Branch: 	
Changes by:	Thomas D <thd at savannah.gnu.org>	06/02/16 03:12:15

Modified files:
	C4             : SearchMarc.pm 

Log message:
	Quick fix for functional bug in getMARCsubjects to avoid returning values that
	vary between different uses of the same authorised subject heading causing
	linked subject searches from the detail view to fail.  Other presentation fixes
	within getMARCsubjects.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha/C4/SearchMarc.pm.diff?tr1=1.55&tr2=1.56&r1=text&r2=text

Patches:
Index: koha/C4/SearchMarc.pm
diff -u koha/C4/SearchMarc.pm:1.55 koha/C4/SearchMarc.pm:1.56
--- koha/C4/SearchMarc.pm:1.55	Tue Feb 14 11:23:38 2006
+++ koha/C4/SearchMarc.pm	Thu Feb 16 03:12:15 2006
@@ -411,7 +411,22 @@
 		$mintag = "600";
 		$maxtag = "699";
 	}
-	my $sth=$dbh->prepare("SELECT subfieldvalue,subfieldcode,tagorder,tag FROM marc_subfield_table WHERE bibid=? AND tag BETWEEN ? AND ? ORDER BY tagorder,subfieldorder");
+	my $sth=$dbh->prepare("SELECT `subfieldvalue`,`subfieldcode`,`tagorder`,`tag` FROM `marc_subfield_table` WHERE `bibid`= ? AND `subfieldcode` NOT IN ('2','4','6','8') AND `tag` BETWEEN ? AND ? ORDER BY `tagorder`,`subfieldorder`");
+	# Subfield exclusion for $2, $4, $6, $8 protects against searching for
+	# variant data in otherwise invariant authorised subject headings when all
+	# returned subfields are used to form a query for matching subjects.  One
+	# example is the use of $2 in MARC 21 where the value of $2 changes for
+	# different editions of the thesaurus used, even where the subject heading
+	# is otherwise the same.  There is certainly a better fix for many cases
+	# where the value of the subfield may be parsed for the invariant data.  
+	# More complete display values may also be separated from query values
+	# containing only the actual invariant authorised subject headings.  More
+	# coding is required for careful value parsing, or display and query
+	# separation; instead of blanket subfield exclusion.
+	# 
+	# As implemented, $3 is passed and might still pose a problem.  Passing $3
+	# could have benefits for some proper use of $3 for UNIMARC, however, might
+	# restrict query usage to a given material type.  -- thd
 
 	$sth->execute($bibid,$mintag,$maxtag);
 
@@ -437,11 +452,14 @@
 		}
 		if ($subfieldcode eq 9) {
 			$field9=$subfieldvalue;
+		} elsif ($subfieldcode eq (3 || 5)) {
+			$subject .= $subfieldvalue . " ";
 		} else {
-			$subject .= $subfieldvalue." -- ";
+			$subject .= $subfieldvalue . " -- ";
 		}
 		$activetagorder=$tagorder;
 	}
+	$subject=~ s/ -- $//;
 	$marcsubjct = {MARCSUBJCT => $subject,
 					link => $lasttag."9",
 					linkvalue => $field9,





More information about the Koha-cvs mailing list