From 0fc57a354ca4af09d8283a48749ef4ce5301629a Mon Sep 17 00:00:00 2001 From: Greg Sabino Mullane Date: Mon, 9 Apr 2007 14:24:15 +0000 Subject: [PATCH] More tweaks to tsearch2 parsing --- includes/SearchPostgres.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/SearchPostgres.php b/includes/SearchPostgres.php index b5ee174bc0..390fcd1fbb 100644 --- a/includes/SearchPostgres.php +++ b/includes/SearchPostgres.php @@ -98,11 +98,11 @@ class SearchPostgres extends SearchEngine { ## Remove any non-spaced operators (e.g. "Zounds!") $searchstring = preg_replace('/([^ ])[\!\&\|]/', "$1", $searchstring); - ## Remove any trailing whitespace - $searchstring = preg_replace('/\s+$/', '', $searchstring); + ## Remove any trailing whitespace or operators + $searchstring = preg_replace('/[\s\!\&\|]+$/', '', $searchstring); - ## Remove any trailing operators - $searchstring = preg_replace('/(?: [\!\&\|])*$/', '', $searchstring); + ## Remove unnecessary quotes around everything + $searchstring = preg_replace('/^[\'"](.*)[\'"]$/', "$1", $searchstring); ## Quote the whole thing $searchstring = $this->db->addQuotes($searchstring); -- 2.20.1