summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorKazutaka Miyasaka <kazmiya@gmail.com>2009-09-21 12:52:01 +0200
committerKazutaka Miyasaka <kazmiya@gmail.com>2009-09-21 12:52:01 +0200
commit7871d415d4361d4d2e63553a85086073132c8df7 (patch)
treece64e19d7185f07bd666c6d55f97646d64f26c61 /inc
parent56fe6664b115c2f694611299b7ee94a836f2aa52 (diff)
downloadrpg-7871d415d4361d4d2e63553a85086073132c8df7.tar.gz
rpg-7871d415d4361d4d2e63553a85086073132c8df7.tar.bz2
treat pipe symbols as 'OR' operators in a search query
Ignore-this: f8687eff4a046379700068b01d94807 darcs-hash:20090921105201-9b77a-6e9ea14dfd7763f8b52ba02f6654f289ac9237e8.gz
Diffstat (limited to 'inc')
-rw-r--r--inc/fulltext.php5
1 files changed, 4 insertions, 1 deletions
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);