added order to folder search

Change-Id: Iee2143c456c6b455d59b23e5e8d8a0a1acd1613f
Signed-off-by: SJ <sj@acts.hu>
This commit is contained in:
SJ 2016-08-16 22:11:26 +02:00
parent 315b26b697
commit c1095a0ab5

View File

@ -30,6 +30,8 @@ class ModelSearchSearch extends Model {
if($data['sort'] == "from") { $sort = "from"; } if($data['sort'] == "from") { $sort = "from"; }
if($data['sort'] == "subj") { $sort = "subject"; } if($data['sort'] == "subj") { $sort = "subject"; }
if(isset($data['folder']) && $data['folder']) { $sort = "id"; }
if($data['order'] == 1) { $order = "ASC"; } if($data['order'] == 1) { $order = "ASC"; }
$sortorder = "ORDER BY `$sort` $order"; $sortorder = "ORDER BY `$sort` $order";
@ -225,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 LIMIT 0,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS); $query = $this->sphx->query("SELECT id FROM " . SPHINX_FOLDER_INDEX . " WHERE folder_id=$folder_id $sortorder LIMIT 0,$pagelen OPTION max_matches=" . MAX_SEARCH_HITS);
} }
else if(isset($data['tag']) && $data['tag']) { else if(isset($data['tag']) && $data['tag']) {
list ($total_found, $num_rows, $id_list) = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag', $page); list ($total_found, $num_rows, $id_list) = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag', $page);