From 288a86cbcc562ace01e0d6300803b242b9580f2d Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Wed, 11 Jul 2012 23:37:11 -0400 Subject: [PATCH 1/1] Add Journal Title search to stock TPAC filters Academics need access to a quick and easy Journal Title search, this gives it to them. Due to the requirement to combine search index + bib level, we define a special search index that can then be acted upon accordingly. Signed-off-by: Dan Scott Signed-off-by: Dan Wells --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 11 +++++++++++ Open-ILS/src/templates/opac/parts/qtype_selector.tt2 | 1 + 2 files changed, 12 insertions(+) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm index 005cae3adc..0280266099 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -25,6 +25,12 @@ sub _prepare_biblio_search_basics { next unless $query =~ /\S/; + # Hack for journal title + my $q = $qtype; + if ($q eq 'jtitle') { + $qtype = 'title'; + } + # This stuff probably will need refined or rethought to better handle # the weird things Real Users will surely type in. $contains = "" unless defined $contains; # silence warning @@ -41,6 +47,11 @@ sub _prepare_biblio_search_basics { } $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0; + # Hack for journal title - completed! + if ($q eq 'jtitle') { + $query = "bib_level:s $query"; + } + $bool = ($bool and $bool eq 'or') ? '||' : '&&'; $full_query = $full_query ? "($full_query $bool $query)" : $query; } diff --git a/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 b/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 index 98567d4ce6..278111bc09 100644 --- a/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 +++ b/Open-ILS/src/templates/opac/parts/qtype_selector.tt2 @@ -1,6 +1,7 @@ [% query_types = [ {value => "keyword", label => l("Keyword")}, {value => "title", label => l("Title")}, + {value => "jtitle", label => l("Journal Title")}, {value => "author", label => l("Author")}, {value => "subject", label => l("Subject")}, {value => "series", label => l("Series")}, -- 2.43.2