From 7871d415d4361d4d2e63553a85086073132c8df7 Mon Sep 17 00:00:00 2001 From: Kazutaka Miyasaka Date: Mon, 21 Sep 2009 12:52:01 +0200 Subject: treat pipe symbols as 'OR' operators in a search query Ignore-this: f8687eff4a046379700068b01d94807 darcs-hash:20090921105201-9b77a-6e9ea14dfd7763f8b52ba02f6654f289ac9237e8.gz --- inc/fulltext.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'inc') diff --git a/inc/fulltext.php b/inc/fulltext.php index 636eb3f76..06834f5ae 100644 --- a/inc/fulltext.php +++ b/inc/fulltext.php @@ -463,7 +463,7 @@ function ft_queryParser($query){ * -() * operators: * and ('and' is the default operator: you can always omit this) - * or (lower precedence than 'and') + * or (or pipe symbol '|', lower precedence than 'and') * * e.g. a query [ aa "bb cc" @dd:ee ] means "search pages which contain * a word 'aa', a phrase 'bb cc' and are within a namespace 'dd:ee'". @@ -500,6 +500,9 @@ function ft_queryParser($query){ $term = str_replace('(' , ' ( ', $term); $term = str_replace('- (', ' -(', $term); + // treat pipe symbols as 'OR' operators + $term = str_replace('|', ' or ', $term); + // treat ideographic spaces (U+3000) as search term separators // FIXME: some more separators? $term = preg_replace('/[ \x{3000}]+/u', ' ', $term); -- cgit v1.2.3