[open-ils-commits] r12737 - branches/rel_1_4_0/Open-ILS/src/perlmods/OpenILS/WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Tue Mar 31 13:29:10 EDT 2009


Author: dbs
Date: 2009-03-31 13:29:05 -0400 (Tue, 31 Mar 2009)
New Revision: 12737

Modified:
   branches/rel_1_4_0/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
Backport r12717 from trunk: prevent apostrophes in search terms from breaking SlimPAC

Modified: branches/rel_1_4_0/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- branches/rel_1_4_0/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-03-31 17:28:28 UTC (rev 12736)
+++ branches/rel_1_4_0/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-03-31 17:29:05 UTC (rev 12737)
@@ -1023,8 +1023,12 @@
 		)->gather(1);
 	}
 
-    my $recs = $search->request(
-        'open-ils.search.biblio.multiclass.query' => {
+	# Apostrophes break search and get indexed as spaces anyway
+	my $safe_terms = $terms;
+	$safe_terms =~ s{'}{ }go;
+
+	my $recs = $search->request(
+		'open-ils.search.biblio.multiclass.query' => {
 			org_unit	=> $org_unit->[0]->id,
 			offset		=> $offset,
 			limit		=> $limit,
@@ -1032,7 +1036,7 @@
 			sort_dir	=> $sortdir,
             default_class => $class,
 			($lang ?    ( 'language' => $lang    ) : ()),
-		} => $terms => 1
+		} => $safe_terms => 1
 	)->gather(1);
 
 	$log->debug("Hits for [$terms]: $recs->{count}");
@@ -1050,7 +1054,7 @@
 
 	$feed->root($root);
 	$feed->lib($org);
-	$feed->search($terms);
+	$feed->search($safe_terms);
 	$feed->class($class);
 
 	$feed->title("Search results for [$terms] at ".$org_unit->[0]->name);



More information about the open-ils-commits mailing list