From d7d7bed5123f9fada3910c2fac1c862f530567c1 Mon Sep 17 00:00:00 2001 From: Andreas Gohr Date: Mon, 5 Feb 2007 20:18:48 +0100 Subject: fix for slashes in phrase search #1066 darcs-hash:20070205191848-7ad00-77ad5a398534a7a64884e155c4607350e0f25a7c.gz --- inc/fulltext.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/inc/fulltext.php b/inc/fulltext.php index f2f071fc5..36a1b049d 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -10,6 +10,13 @@ require_once(DOKU_INC.'inc/indexer.php'); +/** + * Wrapper around preg_quote adding the default delimiter + */ +function ft_preg_quote_cb($string){ + return preg_quote($string,'/'); +} + /** * The fulltext search * @@ -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){ -- cgit v1.2.3