[open-ils-commits] r15547 - trunk/Open-ILS/src/perlmods/OpenILS/Application/Search (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Feb 16 10:39:18 EST 2010
Author: miker
Date: 2010-02-16 10:39:16 -0500 (Tue, 16 Feb 2010)
New Revision: 15547
Modified:
trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
ARG! attempted support for search term containing colons ended up breaking multiclass searching
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2010-02-16 15:11:37 UTC (rev 15546)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2010-02-16 15:39:16 UTC (rev 15547)
@@ -563,12 +563,28 @@
$logger->debug("cleansed query string => $query");
my $search = $arghash->{searches} = {};
- while ($query =~ s/((?:keyword(?:\|\w+)?|title(?:\|\w+)?|author(?:\|\w+)?|subject(?:\|\w+)?|series(?:\|\w+)?|site|dir|sort|lang|available):.+?)$//so) {
+ my $simple_class_re = qr/((?:\w+(?:\|\w+)?):[^:]+?)$/;
+ my $class_list_re = qr/(?:keyword|title|author|subject|series)/;
+ my $modifier_list_re = qr/(?:site|dir|sort|lang|available)/;
+
+ my $tmp_value = '';
+ while ($query =~ s/($simple_class_re[^:]+?)$//so) {
+
my $qpart = $1;
my $where = index($qpart,':');
my $type = substr($qpart, 0, $where++);
my $value = substr($qpart, $where);
+ if ($type !~ /^(?:$class_list_re|$modifier_list_re)/o) {
+ $tmp_value = "$qpart $tmp_value";
+ next;
+ }
+
+ if ($type =~ /$class_list_re/o ) {
+ $value .= $tmp_value;
+ $tmp_value = '';
+ }
+
next unless $type and $value;
$value =~ s/^\s*//og;
@@ -607,8 +623,11 @@
}
}
+ $query .= " $tmp_value";
+
if($query) {
- # This is the front part of the string before any special tokens were parsed.
+ # This is the front part of the string before any special tokens were
+ # parsed OR colon-separated strings that do not denote a class.
# Add this data to the default search class
my $type = $arghash->{default_class} || 'keyword';
$type = ($type eq '-') ? 'keyword' : $type;
More information about the open-ils-commits
mailing list