From 6d3cdacfb61c60d2cf33a16b0513fdd9074de487 Mon Sep 17 00:00:00 2001 From: dbs Date: Sun, 29 Mar 2009 21:20:57 +0000 Subject: [PATCH] Naive implementation of protection against apostrophes in SlimPAC search. Fix for #55. git-svn-id: svn://svn.open-ils.org/ILS/trunk@12717 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm index a6b17f5d3e..9611f81507 100644 --- a/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm +++ b/Open-ILS/src/perlmods/OpenILS/WWW/SuperCat.pm @@ -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); -- 2.11.0