summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2007-02-05 20:18:48 +0100
committerAndreas Gohr <andi@splitbrain.org>2007-02-05 20:18:48 +0100
commitd7d7bed5123f9fada3910c2fac1c862f530567c1 (patch)
tree3b55cd9378f1f4b59c4986334a8db5718be46f96
parente0e755d70c84542881ee291b2419b745430dcbd3 (diff)
downloadrpg-d7d7bed5123f9fada3910c2fac1c862f530567c1.tar.gz
rpg-d7d7bed5123f9fada3910c2fac1c862f530567c1.tar.bz2
fix for slashes in phrase search #1066
darcs-hash:20070205191848-7ad00-77ad5a398534a7a64884e155c4607350e0f25a7c.gz
-rw-r--r--inc/fulltext.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/inc/fulltext.php b/inc/fulltext.php
index f2f071fc5..36a1b049d 100644
--- a/inc/fulltext.php
+++ b/inc/fulltext.php
@@ -11,6 +11,13 @@
/**
+ * Wrapper around preg_quote adding the default delimiter
+ */
+function ft_preg_quote_cb($string){
+ return preg_quote($string,'/');
+}
+
+/**
* The fulltext search
*
* Returns a list of matching documents for the given query
@@ -69,7 +76,7 @@ function ft_pageSearch($query,&$poswords){
if(count($q['phrases'])){
//build a regexp
$q['phrases'] = array_map('utf8_strtolower',$q['phrases']);
- $q['phrases'] = array_map('preg_quote',$q['phrases']);
+ $q['phrases'] = array_map('ft_preg_quote_cb',$q['phrases']);
$regex = '('.join('|',$q['phrases']).')';
// check the source of all documents for the exact phrases
foreach(array_keys($docs) as $id){