作者 邓超

优化同步

... ... @@ -141,12 +141,12 @@ class HomeEs extends Base {
if(is_array($address)){
// 发贱人
if(Verify::sEmail($address['from']??'')){
$query['query']['bool']['must'][] = ['match'=>['from.email'=>$address['from']]];
$query['query']['bool']['must'][] = ['match_phrase'=>['from.email'=>$address['from']]];
}
// 收件人
if(Verify::sEmail($address['to']??'')){
$query['query']['bool']['must'][] = [
'match' => [
'match_phrase' => [
'to'=> $address['to'],
]
];
... ... @@ -156,10 +156,10 @@ class HomeEs extends Base {
$query['query']['bool']['must'][] = [
'bool' =>[
'must'=>[
['match'=>['from.email'=>$address]]
['match_phrase'=>['from.email'=>$address]]
],
'should'=>[
['match'=>['to'=>$address]]
['match_phrase'=>['to'=>$address]]
]
]
];
... ... @@ -191,7 +191,12 @@ class HomeEs extends Base {
// 不让查询数据
$query['query']['bool']['must'][] = ['term'=>['uuid'=>0]];
}else{
$query['query']['bool']['must'][] = ['match'=>['from.email'=>$from]];
$from = is_array($from)?$from:[$from];
$query['query']['bool']['must'][] = ['query_string'=>[
'query'=>'from.email:('.implode(' OR ',array_map(function($e){
return '"'.$e.'"';
},$from)).')']
];
}
}
... ...