From a841f7e50acd27565ef21734c4cbbeee096d051c Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 3 Dec 2015 16:13:09 -0500 Subject: [PATCH] LP#1522538: Improper detection of jtitle search type Before this change, the system would only check the first qtype URL parameter to see if it needed to apply the journal title "bib_level(s)" filter. Instead it should check each qtype in turn while it turns an advanced search into a simple search string. Here the code is moved into place to accomplish that. To test, load all test datasets into a fresh database. Perform an advanced search on journal title for "proceedings" (no quotes) using the second search input row. Before this commit, two records are retrieved. After, only one is retrieved. Signed-off-by: Mike Rylander Signed-off-by: Kathy Lussier --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) 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 ccd84712cb..ecd1bad8ae 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Search.pm @@ -26,8 +26,10 @@ sub _prepare_biblio_search_basics { next unless $query =~ /\S/; # Hack for journal title + my $jtitle = 0; if ($qtype eq 'jtitle') { $qtype = 'title'; + $jtitle = 1; } # This stuff probably will need refined or rethought to better handle @@ -49,6 +51,12 @@ sub _prepare_biblio_search_basics { $query = '^' . $query; $query = ('"' . $query . '"') if index $query, ' '; } + + # Journal title hackery complete + if ($jtitle) { + $query = "bib_level(s) $query"; + } + $query = "$qtype:$query" unless $qtype eq 'keyword' and $i == 0; $bool = ($bool and $bool eq 'or') ? '||' : '&&'; @@ -91,11 +99,6 @@ sub _prepare_biblio_search { $query = "container(bre,bookbag," . int($cgi->param("bookbag")) . ") $query"; } - # Journal title hackery complete - if ($cgi->param("qtype") && $cgi->param("qtype") eq "jtitle") { - $query = "bib_level(s) $query"; - } - if ($cgi->param('pubdate') && $cgi->param('date1')) { if ($cgi->param('pubdate') eq 'between') { my $btw = 'between(' . $cgi->param('date1'); -- 2.43.2