Naive implementation of protection against apostrophes in SlimPAC search. Fix for...
authordbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 29 Mar 2009 21:20:57 +0000 (21:20 +0000)
committerdbs <dbs@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Sun, 29 Mar 2009 21:20:57 +0000 (21:20 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@12717 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm

index a6b17f5..9611f81 100644 (file)
@@ -1064,15 +1064,19 @@ sub opensearch_feed {
                )->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 @@ sub opensearch_feed {
 
        $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);