ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilMailLuceneSearcher.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3
10{
14 protected $query_parser;
15
19 protected $result;
20
24 protected $settings;
25
30 {
31 global $DIC;
32
33 $this->settings = $DIC->settings();
34
35 $this->query_parser = $query_parser;
36 $this->result = $result;
37 }
38
44 public function search($user_id, $mail_folder_id)
45 {
46 if (!$this->query_parser->getQuery()) {
47 throw new ilException('mail_search_query_missing');
48 }
49
50 try {
51 include_once 'Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
52 $xml = ilRpcClientFactory::factory('RPCSearchHandler')->searchMail(
53 CLIENT_ID . '_' . $this->settings->get('inst_id', 0),
54 (int) $user_id,
55 (string) $this->query_parser->getQuery(),
56 (int) $mail_folder_id
57 );
58 } catch (Exception $e) {
59 require_once './Services/Logging/classes/public/class.ilLoggerFactory.php';
60 ilLoggerFactory::getLogger('mail')->critical($e->getMessage());
61 throw $e;
62 }
63
64 include_once 'Services/Mail/classes/class.ilMailSearchLuceneResultParser.php';
65 $parser = new ilMailSearchLuceneResultParser($this->result, $xml);
66 $parser->parse();
67 }
68}
An exception for terminatinating execution or to throw for unit testing.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getLogger($a_component_id)
Get component logger.
__construct(ilLuceneQueryParser $query_parser, ilMailSearchResult $result)
search($user_id, $mail_folder_id)
static factory($a_package, $a_timeout=0)
Creates an ilRpcClient instance to our ilServer.
const CLIENT_ID
Definition: constants.php:39
global $DIC
Definition: goto.php:24
$xml
Definition: metadata.php:332
settings()
Definition: settings.php:2