ILIAS  trunk Revision v11.0_alpha-1723-g8e69f309bab
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilMailLuceneSearcher.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
27  protected ilSetting $settings;
28 
29  public function __construct(protected ilLuceneQueryParser $query_parser, protected ilMailSearchResult $result)
30  {
31  global $DIC;
32  $this->settings = $DIC->settings();
33  }
34 
35  public function search(int $user_id, int $mail_folder_id): void
36  {
37  if ($this->query_parser->getQuery() === '') {
38  throw new ilMailException('mail_search_query_missing');
39  }
40 
41  try {
42  $xml = ilRpcClientFactory::factory('RPCSearchHandler')->searchMail(
43  CLIENT_ID . '_' . $this->settings->get('inst_id', '0'),
44  $user_id,
45  $this->query_parser->getQuery(),
46  $mail_folder_id
47  );
48  } catch (Exception $e) {
49  ilLoggerFactory::getLogger('mail')->critical($e->getMessage());
50  throw $e;
51  }
52 
53  $parser = new ilMailSearchLuceneResultParser($this->result, $xml);
54  $parser->parse();
55  }
56 }
static getLogger(string $a_component_id)
Get component logger.
search(int $user_id, int $mail_folder_id)
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
const CLIENT_ID
Definition: constants.php:41
global $DIC
Definition: shib_login.php:22
__construct(protected ilLuceneQueryParser $query_parser, protected ilMailSearchResult $result)