diff options
Diffstat (limited to 'actions')
-rw-r--r-- | actions/noticesearch.php | 7 | ||||
-rw-r--r-- | actions/noticesearchrss.php | 8 | ||||
-rw-r--r-- | actions/peoplesearch.php | 7 |
3 files changed, 18 insertions, 4 deletions
diff --git a/actions/noticesearch.php b/actions/noticesearch.php index c257ecec5..7022109e6 100644 --- a/actions/noticesearch.php +++ b/actions/noticesearch.php @@ -40,7 +40,12 @@ class NoticesearchAction extends SearchAction { # lcase it for comparison $q = strtolower($q); - $notice->whereAdd('MATCH(content) against (\''.addslashes($q).'\')'); + + if(common_config('db','type')=='mysql') { + $notice->whereAdd('MATCH(content) against (\''.addslashes($q).'\')'); + } else { + $notice->whereAdd('to_tsvector(\'english\', content) @@ plainto_tsquery(\''.addslashes($q).'\')'); + } # Ask for an extra to see if there's more. diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php index c9d08ce8e..f598d833e 100644 --- a/actions/noticesearchrss.php +++ b/actions/noticesearchrss.php @@ -39,7 +39,11 @@ class NoticesearchrssAction extends Rss10Action { # lcase it for comparison $q = strtolower($q); - $notice->whereAdd('MATCH(content) against (\''.addslashes($q).'\')'); + if(common_config('db','type')=='mysql') { + $notice->whereAdd('MATCH(content) against (\''.addslashes($q).'\')'); + } else { + $notice->whereAdd('to_tsvector(\'english\',content) @@ plainto_tsquery(\''.addslashes($q).'\')'); + } $notice->orderBy('created DESC, notice.id DESC'); # Ask for an extra to see if there's more. @@ -70,4 +74,4 @@ class NoticesearchrssAction extends Rss10Action { function get_image() { return NULL; } -}
\ No newline at end of file +} diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php index adacc0954..4e0ec3f0c 100644 --- a/actions/peoplesearch.php +++ b/actions/peoplesearch.php @@ -39,8 +39,13 @@ class PeoplesearchAction extends SearchAction { # lcase it for comparison $q = strtolower($q); - $profile->whereAdd('MATCH(nickname, fullname, location, bio, homepage) ' . + + if(common_config('db','type')=='mysql') { + $profile->whereAdd('MATCH(nickname, fullname, location, bio, homepage) ' . 'against (\''.addslashes($q).'\')'); + } else { + $profile->whereAdd('textsearch @@ plainto_tsquery(\''.addslashes($q).'\')'); + } # Ask for an extra to see if there's more. |