mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-11-08 00:41:59 +01:00
search for attachment names
This commit is contained in:
parent
12c1c62a35
commit
c12f32fbd4
@ -198,6 +198,7 @@ $config['SPHINX_DRIVER'] = 'sphinx';
|
|||||||
$config['SPHINX_DATABASE'] = 'sphinx';
|
$config['SPHINX_DATABASE'] = 'sphinx';
|
||||||
$config['SPHINX_HOSTNAME'] = '127.0.0.1:9306';
|
$config['SPHINX_HOSTNAME'] = '127.0.0.1:9306';
|
||||||
$config['SPHINX_MAIN_INDEX'] = 'main1,dailydelta1,delta1';
|
$config['SPHINX_MAIN_INDEX'] = 'main1,dailydelta1,delta1';
|
||||||
|
$config['SPHINX_ATTACHMENT_INDEX'] = 'att1';
|
||||||
$config['SPHINX_TAG_INDEX'] = 'tag1';
|
$config['SPHINX_TAG_INDEX'] = 'tag1';
|
||||||
$config['SPHINX_NOTE_INDEX'] = 'note1';
|
$config['SPHINX_NOTE_INDEX'] = 'note1';
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ class ControllerSearchHelper extends Controller {
|
|||||||
'date2' => '',
|
'date2' => '',
|
||||||
'direction' => '',
|
'direction' => '',
|
||||||
'size' => '',
|
'size' => '',
|
||||||
|
'aname' => '',
|
||||||
'attachment_type' => '',
|
'attachment_type' => '',
|
||||||
'tag' => '',
|
'tag' => '',
|
||||||
'note' => '',
|
'note' => '',
|
||||||
@ -44,7 +45,7 @@ class ControllerSearchHelper extends Controller {
|
|||||||
|
|
||||||
if($this->request->post['searchtype'] == 'expert'){
|
if($this->request->post['searchtype'] == 'expert'){
|
||||||
|
|
||||||
if(isset($this->request->post['search']) && preg_match("/(from|to|subject|body|direction|d|size|date1|date2|attachment|a|tag|note|id)\:/", $this->request->post['search'])) {
|
if(isset($this->request->post['search']) && preg_match("/(from|to|subject|body|direction|d|size|date1|date2|attachment|a|aname|tag|note|id)\:/", $this->request->post['search'])) {
|
||||||
$this->a = $this->model_search_search->preprocess_post_expert_request($this->request->post);
|
$this->a = $this->model_search_search->preprocess_post_expert_request($this->request->post);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -214,7 +214,10 @@ class ModelSearchSearch extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isset($data['tag']) && $data['tag']) {
|
if(isset($data['aname']) && $data['aname']) {
|
||||||
|
$query = $this->sphx->query("SELECT id, mid FROM " . SPHINX_ATTACHMENT_INDEX . " WHERE MATCH('" . $data['aname'] . "') $sortorder LIMIT 0," . MAX_SEARCH_HITS . " OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||||
|
}
|
||||||
|
else if(isset($data['tag']) && $data['tag']) {
|
||||||
$id_list = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag');
|
$id_list = $this->get_sphinx_id_list($data['tag'], SPHINX_TAG_INDEX, 'tag');
|
||||||
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $folders id IN ($id_list) $sortorder LIMIT 0," . MAX_SEARCH_HITS . " OPTION max_matches=" . MAX_SEARCH_HITS);
|
$query = $this->sphx->query("SELECT id FROM " . SPHINX_MAIN_INDEX . " WHERE $folders id IN ($id_list) $sortorder LIMIT 0," . MAX_SEARCH_HITS . " OPTION max_matches=" . MAX_SEARCH_HITS);
|
||||||
}
|
}
|
||||||
@ -243,7 +246,8 @@ class ModelSearchSearch extends Model {
|
|||||||
|
|
||||||
if(isset($query->rows)) {
|
if(isset($query->rows)) {
|
||||||
foreach($query->rows as $a) {
|
foreach($query->rows as $a) {
|
||||||
array_push($ids, $a['id']);
|
if(isset($a['mid'])) { array_push($ids, $a['mid']); }
|
||||||
|
else { array_push($ids, $a['id']); }
|
||||||
|
|
||||||
if($q) { $q .= ",?"; }
|
if($q) { $q .= ",?"; }
|
||||||
else { $q = "?"; }
|
else { $q = "?"; }
|
||||||
@ -322,6 +326,7 @@ class ModelSearchSearch extends Model {
|
|||||||
'date2' => '',
|
'date2' => '',
|
||||||
'direction' => '',
|
'direction' => '',
|
||||||
'size' => '',
|
'size' => '',
|
||||||
|
'aname' => '',
|
||||||
'attachment_type' => '',
|
'attachment_type' => '',
|
||||||
'tag' => '',
|
'tag' => '',
|
||||||
'note' => '',
|
'note' => '',
|
||||||
@ -357,6 +362,7 @@ class ModelSearchSearch extends Model {
|
|||||||
else if($v == 'date1:') { $token = 'date1'; continue; }
|
else if($v == 'date1:') { $token = 'date1'; continue; }
|
||||||
else if($v == 'date2:') { $token = 'date2'; continue; }
|
else if($v == 'date2:') { $token = 'date2'; continue; }
|
||||||
else if($v == 'attachment:' || $v == 'a:') { $token = 'match'; $a['match'][] = '@attachment_types'; continue; }
|
else if($v == 'attachment:' || $v == 'a:') { $token = 'match'; $a['match'][] = '@attachment_types'; continue; }
|
||||||
|
else if($v == 'aname:') { $token = 'aname'; continue; }
|
||||||
else if($v == 'size') { $token = 'size'; continue; }
|
else if($v == 'size') { $token = 'size'; continue; }
|
||||||
else if($v == 'tag:') { $token = 'tag'; continue; }
|
else if($v == 'tag:') { $token = 'tag'; continue; }
|
||||||
else if($v == 'note:') { $token = 'note'; continue; }
|
else if($v == 'note:') { $token = 'note'; continue; }
|
||||||
@ -370,6 +376,13 @@ class ModelSearchSearch extends Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($token == 'match') { $a['match'][] = $v; }
|
if($token == 'match') { $a['match'][] = $v; }
|
||||||
|
else if($token == 'aname') {
|
||||||
|
if($v != '|') {
|
||||||
|
$a['aname'] .= '"' . $v . '"';
|
||||||
|
} else {
|
||||||
|
$a['aname'] .= ' | ';
|
||||||
|
}
|
||||||
|
}
|
||||||
else if($token == 'date1') { $a['date1'] = ' ' . $v; }
|
else if($token == 'date1') { $a['date1'] = ' ' . $v; }
|
||||||
else if($token == 'date2') { $a['date2'] = ' ' . $v; }
|
else if($token == 'date2') { $a['date2'] = ' ' . $v; }
|
||||||
else if($token == 'tag') { $a['tag'] .= ' ' . $v; }
|
else if($token == 'tag') { $a['tag'] .= ' ' . $v; }
|
||||||
|
Loading…
Reference in New Issue
Block a user