summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
Diffstat (limited to 'actions')
-rw-r--r--actions/noticesearch.php11
-rw-r--r--actions/noticesearchrss.php17
-rw-r--r--actions/peoplesearch.php14
3 files changed, 20 insertions, 22 deletions
diff --git a/actions/noticesearch.php b/actions/noticesearch.php
index f8dad2a20..96e4d777f 100644
--- a/actions/noticesearch.php
+++ b/actions/noticesearch.php
@@ -20,7 +20,6 @@
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/searchaction.php');
-define('NOTICES_PER_PAGE', 20);
# XXX common parent for people and content search?
@@ -42,13 +41,17 @@ class NoticesearchAction extends SearchAction {
$q = strtolower($q);
$search_engine = $notice->getSearchEngine('identica_notices');
- $search_engine->query($q);
+ $search_engine->set_sort_mode('chron');
# Ask for an extra to see if there's more.
$search_engine->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
- $cnt = $notice->find();
-
+ if (false === $search_engine->query($q)) {
+ $cnt = 0;
+ }
+ else {
+ $cnt = $notice->find();
+ }
if ($cnt > 0) {
$terms = preg_split('/[\s,]+/', $q);
common_element_start('ul', array('id' => 'notices'));
diff --git a/actions/noticesearchrss.php b/actions/noticesearchrss.php
index f598d833e..0f38515a0 100644
--- a/actions/noticesearchrss.php
+++ b/actions/noticesearchrss.php
@@ -39,19 +39,12 @@ class NoticesearchrssAction extends Rss10Action {
# lcase it for comparison
$q = strtolower($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.
-
- if ($limit != 0) {
- $notice->limit(0, $limit);
- }
+ $search_engine = $notice->getSearchEngine('identica_notices');
+ $search_engine->set_sort_mode('chron');
+ if (!$limit) $limit = 20;
+ $search_engine->limit(0, $limit, true);
+ $search_engine->query($q);
$notice->find();
while ($notice->fetch()) {
diff --git a/actions/peoplesearch.php b/actions/peoplesearch.php
index fa54dc9f7..f4886fd83 100644
--- a/actions/peoplesearch.php
+++ b/actions/peoplesearch.php
@@ -20,7 +20,7 @@
if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/searchaction.php');
-require_once(INSTALLDIR.'/lib/profilelist.php');
+define('PROFILES_PER_PAGE', 10);
class PeoplesearchAction extends SearchAction {
@@ -42,13 +42,15 @@ class PeoplesearchAction extends SearchAction {
$search_engine = $profile->getSearchEngine('identica_people');
- $search_engine->query($q);
-
+ $search_engine->set_sort_mode('chron');
# Ask for an extra to see if there's more.
$search_engine->limit((($page-1)*PROFILES_PER_PAGE), PROFILES_PER_PAGE + 1);
-
- $cnt = $profile->find();
-
+ if (false === $search_engine->query($q)) {
+ $cnt = 0;
+ }
+ else {
+ $cnt = $profile->find();
+ }
if ($cnt > 0) {
$terms = preg_split('/[\s,]+/', $q);
$results = new PeopleSearchResults($profile, $terms);