Add Journal Title search to stock TPAC filters
authorDan Scott <dan@coffeecode.net>
Thu, 12 Jul 2012 03:37:11 +0000 (23:37 -0400)
committerDan Wells <dbw2@calvin.edu>
Wed, 18 Jul 2012 16:23:32 +0000 (12:23 -0400)
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 <dan@coffeecode.net>
Signed-off-by: Dan Wells <dbw2@calvin.edu>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm
Open-ILS/src/templates/opac/parts/qtype_selector.tt2

index 005cae3..0280266 100644 (file)
@@ -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;
     }
index 98567d4..278111b 100644 (file)
@@ -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")},