mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 18:50:12 +01:00
from -> sender transition, part 1
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
08d5d0129d
commit
c6ecefddbf
@ -37,7 +37,7 @@ source delta : base
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query_pre = REPLACE INTO sph_counter SELECT 1, IFNULL(MAX(id), 0) FROM sph_index
|
||||
sql_query_post_index = DELETE FROM sph_index WHERE id<=(SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index \
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index \
|
||||
WHERE id <= (SELECT max_doc_id FROM sph_counter WHERE counter_id=1)
|
||||
|
||||
<?php if(SPHINX_VERSION < 300) { ?>
|
||||
@ -50,31 +50,31 @@ source delta : base
|
||||
source main1 : base
|
||||
{
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
}
|
||||
|
||||
source main2 : base
|
||||
{
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
}
|
||||
|
||||
source main3 : base
|
||||
{
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
}
|
||||
|
||||
source main4 : base
|
||||
{
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
}
|
||||
|
||||
source dailydelta : base
|
||||
{
|
||||
sql_query_pre = SET NAMES utf8mb4
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain`, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
sql_query = SELECT id, `from` as sender, `to`, `fromdomain` as senderdomain, `todomain`, `subject`, `arrived`, `sent`, `body`, `size`, `direction`, `folder`, `attachments`, `attachment_types` FROM sph_index WHERE id=-1
|
||||
}
|
||||
|
||||
source tag : base
|
||||
|
@ -62,7 +62,7 @@ run_05_sphinx_tests() {
|
||||
|
||||
append_queries() {
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE MATCH('@subject budaörsi dc felmérés')" 9
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE MATCH('@from gruppi.hu')" 4
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE MATCH('@sender gruppi.hu')" 4
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE attachments > 0 AND MATCH('@subject spam ')" 85
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE attachments > 0 AND MATCH('@subject spam @attachment_types image')" 15
|
||||
append_query "select * from main1,dailydelta1,delta1 WHERE MATCH('@(subject,body) New Task TSK002*')" 29
|
||||
|
@ -98,7 +98,7 @@ class ControllerSearchHelper extends Controller {
|
||||
private function fixup_post_simple_request() {
|
||||
$match = '';
|
||||
|
||||
if(isset($this->request->post['from']) && $this->request->post['from']) { $match .= "@from " . $this->request->post['from'] . ' '; }
|
||||
if(isset($this->request->post['from']) && $this->request->post['from']) { $match .= "@sender " . $this->request->post['from'] . ' '; }
|
||||
if(isset($this->request->post['to']) && $this->request->post['to']) { $match .= "@to " . $this->request->post['to'] . ' '; }
|
||||
if(isset($this->request->post['subject']) && $this->request->post['subject']) { $match .= "@subject " . $this->request->post['subject'] . ' '; }
|
||||
if(isset($this->request->post['body']) && $this->request->post['body']) { $match .= "@body " . $this->request->post['body'] . ' '; }
|
||||
@ -149,7 +149,7 @@ class ControllerSearchHelper extends Controller {
|
||||
}
|
||||
else if(strchr($v, '@')) {
|
||||
$prev_token_is_email = 1;
|
||||
if($from == '') { $from = "@from"; }
|
||||
if($from == '') { $from = "@sender"; }
|
||||
$from .= " $v";
|
||||
}
|
||||
else {
|
||||
|
@ -73,7 +73,7 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
$sd = preg_replace("/^\|/", "", $sd);
|
||||
|
||||
return " (@todomain $sd | @fromdomain $sd ) ";
|
||||
return " (@todomain $sd | @senderdomain $sd ) ";
|
||||
}
|
||||
|
||||
else { return ""; }
|
||||
@ -82,7 +82,7 @@ class ModelSearchSearch extends Model {
|
||||
if(ENABLE_FOLDER_RESTRICTIONS == 1) { return ""; }
|
||||
|
||||
$all_your_addresses = $this->get_all_your_address();
|
||||
return " (@from $all_your_addresses | @to $all_your_addresses) ";
|
||||
return " (@sender $all_your_addresses | @to $all_your_addresses) ";
|
||||
}
|
||||
|
||||
|
||||
@ -96,7 +96,7 @@ class ModelSearchSearch extends Model {
|
||||
$id = "";
|
||||
$offset = 0;
|
||||
$total_sphx_hits = $num_rows = 0;
|
||||
$fields = array("@(subject,body)", "@from", "@to", "@subject", "@body", "@attachment_types");
|
||||
$fields = array("@(subject,body)", "@sender", "@to", "@subject", "@body", "@attachment_types");
|
||||
|
||||
|
||||
$pagelen = get_page_length();
|
||||
@ -128,7 +128,7 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
if(substr($v, 0, 1) == "@") {
|
||||
$v = substr($v, 1, strlen($v)-1);
|
||||
if($data['match'][$i-1] == "@from") { $data['match'][$i-1] = "@fromdomain"; }
|
||||
if($data['match'][$i-1] == "@sender") { $data['match'][$i-1] = "@senderdomain"; }
|
||||
if($data['match'][$i-1] == "@to") { $data['match'][$i-1] = "@todomain"; }
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ class ModelSearchSearch extends Model {
|
||||
while(list($k, $v) = each($b)) {
|
||||
if($v == '') { continue; }
|
||||
|
||||
if($v == 'from:') { $token = 'match'; $a['match'][] = '@from'; continue; }
|
||||
if($v == 'from:') { $token = 'match'; $a['match'][] = '@sender'; continue; }
|
||||
else if($v == 'to:') { $token = 'match'; $a['match'][] = '@to'; continue; }
|
||||
else if($v == 'subject:') { $token = 'match'; $a['match'][] = '@subject'; continue; }
|
||||
else if($v == 'body:') { $token = 'match'; $a['match'][] = '@body'; continue; }
|
||||
|
Loading…
Reference in New Issue
Block a user