From: erickson Date: Thu, 15 Nov 2007 22:01:45 +0000 (+0000) Subject: capturing any preceding search terms and appending them to the default search class... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=ee791c29df0674d7dde1387be08043096a60217e;p=Evergreen.git capturing any preceding search terms and appending them to the default search class. rolling back previous change which allowed the query string to complement existing searches in the hash.. now the query string is the only source of class-based search data. git-svn-id: svn://svn.open-ils.org/ILS/trunk@8069 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm index 1e7aa4ab5a..86cfdb33bb 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm @@ -463,9 +463,7 @@ sub multiclass_query { $query =~ s/name(:|\|)/author$1/og; $logger->debug("cleansed query string => $query"); - - my $search = $arghash->{searches}; - $arghash->{searches} = $search = {} unless $search; + my $search = $arghash->{searches} = {}; while ($query =~ s/((?:keyword(?:\|\w+)?|title(?:\|\w+)?|author(?:\|\w+)?|subject(?:\|\w+)?|series(?:\|\w+)?|site|dir|sort|lang|available):[^:]+)$//so) { my($type, $value) = split(':', $1); @@ -503,6 +501,15 @@ sub multiclass_query { } } + if($query) { + # This is the front part of the string before any special tokens were parsed. + # Add this data to the default search class + my $type = $arghash->{default_class} || 'keyword'; + $search->{$type} = {} unless $search->{$type}; + $search->{$type}->{term} = + ($search->{$type}->{term}) ? $search->{$type}->{term} . " $query" : $query; + } + # capture the original limit because the search method alters the limit internally my $ol = $arghash->{limit}; @@ -512,7 +519,9 @@ sub multiclass_query { $arghash->{limit} = $ol if $ol; $data->{compiled_search} = $arghash; + $logger->info("compiled search is " . OpenSRF::Utils::JSON->perl2JSON($arghash)); + return $data; }