作者 邓超

es调整

@@ -155,11 +155,9 @@ class HomeEs extends Base { @@ -155,11 +155,9 @@ class HomeEs extends Base {
155 }else if(Verify::sEmail($address)){// 收件人/发件人 155 }else if(Verify::sEmail($address)){// 收件人/发件人
156 $query['query']['bool']['must'][] = [ 156 $query['query']['bool']['must'][] = [
157 'bool' =>[ 157 'bool' =>[
158 - 'must'=>[  
159 - ['match_phrase'=>['from.email'=>$address]]  
160 - ],  
161 'should'=>[ 158 'should'=>[
162 - ['match_phrase'=>['to'=>$address]] 159 + ['bool'=>['must'=>[['match_phrase'=>['from.email'=>$address]]]]],
  160 + ['bool'=>['must'=>[['match_phrase'=>['to'=>$address]]]]],
163 ] 161 ]
164 ] 162 ]
165 ]; 163 ];
@@ -339,73 +339,7 @@ class MailListV2Es extends Base { @@ -339,73 +339,7 @@ class MailListV2Es extends Base {
339 return ['terms'=>['folder_id'=> $this->getFolderId($folder)]]; 339 return ['terms'=>['folder_id'=> $this->getFolderId($folder)]];
340 340
341 } 341 }
342 - private function assignSql2(){  
343 - // 被分配的  
344 - $assign = app()->request('assign');  
345 - $sql = '';  
346 - $query = [];  
347 - if(!empty($assign['email_id'])){  
348 - // 分配的联系人  
349 - $email = array_values(array_intersect($assign['email_id'],$this->getEmails('id')));  
350 - if($email&&!empty($assign['from'])){  
351 - $query['must'] = [  
352 - ['terms'=>['email_id'=>$email]]  
353 - ];  
354 - $query['must'][] = [  
355 - 'query'=>[  
356 - 'bool'=>[  
357 - 'must'=>[  
358 - ['terms'=>['from.email'=>$assign['from']]]  
359 - ],  
360 - 'should'=>[  
361 - "query_string" =>[  
362 - "query" => implode(' ',$assign['from']),  
363 - 'default_field' => 'to'  
364 - ]  
365 - ]  
366 - ]  
367 - ]  
368 - ];  
369 - }  
370 342
371 - // 分配的邮箱  
372 - $email2 = array_diff($this->getEmails('id'),$assign['email_id']);  
373 - if($email2){  
374 - if($query){  
375 - $query['must'][] = [  
376 - 'query'=>[  
377 - 'bool'=>[  
378 - 'must'=>[  
379 - $query  
380 - ],  
381 - 'should'=>[  
382 - ['terms'=>['email_id'=>$email2]]  
383 - ]  
384 - ]  
385 - ]  
386 - ];  
387 - return ['query'=>[  
388 - 'bool'=> $query  
389 - ]];  
390 - }  
391 -  
392 - return ['terms'=>['email_id'=>$email2]];  
393 - }  
394 -  
395 - if($sql){  
396 - return ['query'=>[  
397 - 'bool'=> $query  
398 - ]];  
399 - }  
400 -  
401 -  
402 - return ['term'=>['email_id'=>-1]];  
403 - }  
404 -  
405 - // 默认  
406 - return ['terms'=>['email_id'=> $this->getEmails('id')]];  
407 -  
408 - }  
409 343
410 private function assignSql3($folder){ 344 private function assignSql3($folder){
411 // 被分配的 345 // 被分配的