fix folder search

Change-Id: I5183dc9db0dbbb517879f65d5c0644f3ebde9a3e
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ 2017-04-01 11:44:36 +02:00
parent 578f1f2075
commit 99dbe35cf3
2 changed files with 5 additions and 3 deletions

View File

@ -89,10 +89,11 @@ source att : base
source folder : base source folder : base
{ {
sql_query_pre = SET NAMES utf8 sql_query_pre = SET NAMES utf8
sql_query = select id, folder_id, message_id, uid FROM folder_message sql_query = select id, folder_id, message_id, uid, 1 FROM folder_message
sql_attr_uint = uid sql_attr_uint = uid
sql_attr_uint = folder_id sql_attr_uint = folder_id
sql_attr_uint = message_id
} }
index main1 index main1

View File

@ -217,7 +217,7 @@ class ModelSearchSearch extends Model {
$num_rows = $query->num_rows; $num_rows = $query->num_rows;
} }
else if(isset($data['folder']) && $data['folder']) { else if(isset($data['folder']) && $data['folder']) {
$folder_id = 0; $folder_id = -1;
$folders = $session->get("folders"); $folders = $session->get("folders");
@ -227,7 +227,7 @@ class ModelSearchSearch extends Model {
$folder_id = $folders[$data['folder']]; $folder_id = $folders[$data['folder']];
} }
$query = $this->sphx->query("SELECT id FROM " . SPHINX_FOLDER_INDEX . " WHERE folder_id=$folder_id $sortorder LIMIT $offset,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS); $query = $this->sphx->query("SELECT message_id FROM " . SPHINX_FOLDER_INDEX . " WHERE folder_id=$folder_id $sortorder LIMIT $offset,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
$total_found = $query->total_found; $total_found = $query->total_found;
$num_rows = $query->num_rows; $num_rows = $query->num_rows;
} }
@ -259,6 +259,7 @@ class ModelSearchSearch extends Model {
if(isset($query->rows)) { if(isset($query->rows)) {
foreach($query->rows as $a) { foreach($query->rows as $a) {
if(isset($a['mid'])) { array_push($ids, $a['mid']); } if(isset($a['mid'])) { array_push($ids, $a['mid']); }
else if(isset($a['message_id'])) { array_push($ids, $a['message_id']); }
else { array_push($ids, $a['id']); } else { array_push($ids, $a['id']); }
if($q) { $q .= ",?"; } if($q) { $q .= ",?"; }