From 1eaa1e9db76c5713ad00fa1fa64dcaad73f212b2 Mon Sep 17 00:00:00 2001 From: gmc Date: Thu, 15 Jul 2010 13:52:06 +0000 Subject: [PATCH] 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 git-svn-id: svn://svn.open-ils.org/ILS/trunk@16938 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../Application/Storage/Publisher/metabib.pm | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm index dc6bf8be9b..22cf193571 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm @@ -445,9 +445,16 @@ sub biblio_multi_search_full_rec { 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 @@ sub search_full_rec { 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); -- 2.11.0