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

svn at svn.open-ils.org svn at svn.open-ils.org
Thu Jul 15 09:52:08 EDT 2010


Author: gmc
Date: 2010-07-15 09:52:06 -0400 (Thu, 15 Jul 2010)
New Revision: 16938

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
Log:
bug 605884: make MARC expert search of control fields work

Allows users to search on the 001 and 003 fields, for example.

Signed-off-by: Galen Charlton <gmc at esilibrary.com>


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm	2010-07-15 10:24:44 UTC (rev 16937)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm	2010-07-15 13:52:06 UTC (rev 16938)
@@ -445,9 +445,16 @@
 
 		my @wheres;
 		for my $limit (@$limiters) {
-			push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
-			push @binds, $$limit{tag}, $$limit{subfield};
- 			$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+			if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
+				# MARC control field; mfr.subfield is NULL
+				push @wheres, "( tag = ? AND $fts_where )";
+				push @binds, $$limit{tag};
+ 				$log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+			} else {
+				push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
+				push @binds, $$limit{tag}, $$limit{subfield};
+ 				$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+			}
 		}
 		my $where = join(' OR ', @wheres);
 
@@ -700,9 +707,16 @@
 	my @binds;
 	my @wheres;
 	for my $limit (@$limiters) {
-		push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
-		push @binds, $$limit{tag}, $$limit{subfield};
- 		$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+		if ($$limit{tag} =~ /^\d+$/ and $$limit{tag} < 10) {
+			# MARC control field; mfr.subfield is NULL
+			push @wheres, "( tag = ? AND $fts_where )";
+			push @binds, $$limit{tag};
+ 			$log->debug("Limiting query using { tag => $$limit{tag} }", DEBUG);
+		} else {
+			push @wheres, "( tag = ? AND subfield LIKE ? AND $fts_where )";
+			push @binds, $$limit{tag}, $$limit{subfield};
+ 			$log->debug("Limiting query using { tag => $$limit{tag}, subfield => $$limit{subfield} }", DEBUG);
+		}
 	}
 	my $where = join(' OR ', @wheres);
 



More information about the open-ils-commits mailing list