mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 01:37:02 +02:00
Introduced sphinx strict mode variable
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
@ -98,8 +98,8 @@ 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['to']) && $this->request->post['to']) { $match .= "@to " . $this->request->post['to'] . ' '; }
|
||||
if(isset($this->request->post['from']) && $this->request->post['from']) { $match .= sprintf('%s %s ', FROM_TOKEN, $this->request->post['from']); }
|
||||
if(isset($this->request->post['to']) && $this->request->post['to']) { $match .= sprintf('%s %s ', TO_TOKEN, $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 = FROM_TOKEN; }
|
||||
$from .= " $v";
|
||||
}
|
||||
else {
|
||||
|
@ -73,7 +73,7 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
$sd = preg_replace("/^\|/", "", $sd);
|
||||
|
||||
return " (@todomain $sd | @fromdomain $sd ) ";
|
||||
return sprintf(" (%s %s | %s %s ) ", TODOMAIN_TOKEN, $sd, FROMDOMAIN_TOKEN, $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 sprintf(" (%s %s | %s %s) ", FROM_TOKEN, $all_your_addresses, TO_TOKEN, $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 = ["@(subject,body)", FROM_TOKEN, TO_TOKEN, "@subject", "@body", "@attachment_types"];
|
||||
|
||||
|
||||
$pagelen = get_page_length();
|
||||
@ -128,8 +128,8 @@ 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] == "@to") { $data['match'][$i-1] = "@todomain"; }
|
||||
if($data['match'][$i-1] == FROM_TOKEN) { $data['match'][$i-1] = FROMDOMAIN_TOKEN; }
|
||||
if($data['match'][$i-1] == TO_TOKEN) { $data['match'][$i-1] = TODOMAIN_TOKEN; }
|
||||
}
|
||||
|
||||
$data['match'][$i] = $this->fix_email_address_for_sphinx($v);
|
||||
@ -351,8 +351,8 @@ class ModelSearchSearch extends Model {
|
||||
while(list($k, $v) = each($b)) {
|
||||
if($v == '') { continue; }
|
||||
|
||||
if($v == 'from:') { $token = 'match'; $a['match'][] = '@from'; continue; }
|
||||
else if($v == 'to:') { $token = 'match'; $a['match'][] = '@to'; continue; }
|
||||
if($v == 'from:') { $token = 'match'; $a['match'][] = FROM_TOKEN; continue; }
|
||||
else if($v == 'to:') { $token = 'match'; $a['match'][] = TO_TOKEN; continue; }
|
||||
else if($v == 'subject:') { $token = 'match'; $a['match'][] = '@subject'; continue; }
|
||||
else if($v == 'body:') { $token = 'match'; $a['match'][] = '@body'; continue; }
|
||||
else if($v == 'direction:' || $v == 'd:') { $token = 'direction'; continue; }
|
||||
|
Reference in New Issue
Block a user