[open-ils-commits] r12717 - trunk/Open-ILS/src/perlmods/OpenILS/WWW (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Sun Mar 29 17:21:02 EDT 2009


Author: dbs
Date: 2009-03-29 17:20:57 -0400 (Sun, 29 Mar 2009)
New Revision: 12717

Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
Log:
Naive implementation of protection against apostrophes in SlimPAC search. Fix for #55.


Modified: trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-03-29 21:03:10 UTC (rev 12716)
+++ trunk/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm	2009-03-29 21:20:57 UTC (rev 12717)
@@ -1064,15 +1064,19 @@
 		)->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,
 			sort		=> $sort,
 			sort_dir	=> $sortdir,
 			($lang ?    ( 'language' => $lang    ) : ()),
-		} => $terms => 1
+		} => $safe_terms => 1
 	)->gather(1);
 
 	$log->debug("Hits for [$terms]: $recs->{count}");
@@ -1090,7 +1094,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