ILIAS  release_8 Revision v8.23
class.ilMailLuceneSearcher.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
26 {
29  protected ilSetting $settings;
30 
31  public function __construct(ilLuceneQueryParser $query_parser, ilMailSearchResult $result)
32  {
33  global $DIC;
34  $this->settings = $DIC->settings();
35  $this->query_parser = $query_parser;
36  $this->result = $result;
37  }
38 
39  public function search(int $user_id, int $mail_folder_id): void
40  {
41  if (!$this->query_parser->getQuery()) {
42  throw new ilException('mail_search_query_missing');
43  }
44 
45  try {
46  $xml = ilRpcClientFactory::factory('RPCSearchHandler')->searchMail(
47  CLIENT_ID . '_' . $this->settings->get('inst_id', '0'),
48  $user_id,
49  $this->query_parser->getQuery(),
50  $mail_folder_id
51  );
52  } catch (Exception $e) {
53  ilLoggerFactory::getLogger('mail')->critical($e->getMessage());
54  throw $e;
55  }
56 
57  $parser = new ilMailSearchLuceneResultParser($this->result, $xml);
58  $parser->parse();
59  }
60 }
static getLogger(string $a_component_id)
Get component logger.
search(int $user_id, int $mail_folder_id)
__construct(ilLuceneQueryParser $query_parser, ilMailSearchResult $result)
static factory(string $a_package, int $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
global $DIC
Definition: feed.php:28
const CLIENT_ID
Definition: constants.php:41
$xml
Definition: metadata.php:351
ilLuceneQueryParser $query_parser