Olq query removed, checking for deleted as well

This commit is contained in:
Michael 2021-10-13 05:11:36 +00:00
parent 27b9da3df5
commit 2904f4ca0e
2 changed files with 2 additions and 16 deletions

View file

@ -45,20 +45,6 @@ function msearch_post(App $a)
$condition = ["`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search]; $condition = ["`net-publish` AND MATCH(`pub_keywords`) AGAINST (?)", $search];
$total = DBA::count('owner-view', $condition); $total = DBA::count('owner-view', $condition);
$count_stmt = DBA::p(
"SELECT COUNT(*) AS `total`
FROM `profile`
JOIN `user` ON `user`.`uid` = `profile`.`uid`
WHERE `profile`.`net-publish`
AND MATCH(`pub_keywords`) AGAINST (?)",
$search
);
if (DBA::isResult($count_stmt)) {
$row = DBA::fetch($count_stmt);
$total = $row['total'];
}
DBA::close($count_stmt);
$search_stmt = DBA::select('owner-view', ['pub_keywords', 'name', 'nickname', 'uid'], $condition, ['limit' => [$startrec, $perpage]]); $search_stmt = DBA::select('owner-view', ['pub_keywords', 'name', 'nickname', 'uid'], $condition, ['limit' => [$startrec, $perpage]]);
while ($search_result = DBA::fetch($search_stmt)) { while ($search_result = DBA::fetch($search_stmt)) {

View file

@ -3022,7 +3022,7 @@ class Contact
$networks[] = Protocol::OSTATUS; $networks[] = Protocol::OSTATUS;
} }
$condition = ['network' => $networks, 'failed' => false, 'uid' => $uid]; $condition = ['network' => $networks, 'failed' => false, 'deleted' => false, 'uid' => $uid];
// check if we search only communities or every contact // check if we search only communities or every contact
if ($mode === 'community') { if ($mode === 'community') {
@ -3032,7 +3032,7 @@ class Contact
$search .= '%'; $search .= '%';
$condition = DBA::mergeConditions($condition, $condition = DBA::mergeConditions($condition,
["(NOT `unsearchable` OR `nurl` IN (SELECT `nurl` FROM `owner-view` where `publish` OR `net-publish`)) ["(NOT `unsearchable` OR `nurl` IN (SELECT `nurl` FROM `owner-view` WHERE `publish` OR `net-publish`))
AND (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]); AND (`addr` LIKE ? OR `name` LIKE ? OR `nick` LIKE ?)", $search, $search, $search]);
$contacts = self::selectToArray([], $condition); $contacts = self::selectToArray([], $condition);