[open-ils-commits] r8069 -
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search
svn at svn.open-ils.org
svn at svn.open-ils.org
Thu Nov 15 17:18:38 EST 2007
Author: erickson
Date: 2007-11-15 17:01:45 -0500 (Thu, 15 Nov 2007)
New Revision: 8069
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
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.
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2007-11-15 19:18:00 UTC (rev 8068)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2007-11-15 22:01:45 UTC (rev 8069)
@@ -463,10 +463,8 @@
$query =~ s/name(:|\|)/author$1/og;
$logger->debug("cleansed query string => $query");
+ my $search = $arghash->{searches} = {};
- my $search = $arghash->{searches};
- $arghash->{searches} = $search = {} unless $search;
-
while ($query =~ s/((?:keyword(?:\|\w+)?|title(?:\|\w+)?|author(?:\|\w+)?|subject(?:\|\w+)?|series(?:\|\w+)?|site|dir|sort|lang|available):[^:]+)$//so) {
my($type, $value) = split(':', $1);
next unless $type and $value;
@@ -503,6 +501,15 @@
}
}
+ 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 @@
$arghash->{limit} = $ol if $ol;
$data->{compiled_search} = $arghash;
+
$logger->info("compiled search is " . OpenSRF::Utils::JSON->perl2JSON($arghash));
+
return $data;
}
More information about the open-ils-commits
mailing list