ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
25  {
26  $this->query_parser = $query_parser;
27  $this->result = $result;
28  }
29 
35  public function search($user_id, $mail_folder_id)
36  {
42  global $ilBench, $ilSetting, $ilLog;
43 
44  if(!$this->query_parser->getQuery())
45  {
46  throw new ilException('mail_search_query_missing');
47  }
48 
49  $ilBench->start('Mail', 'LuceneSearch');
50  try
51  {
52  include_once 'Services/WebServices/RPC/classes/class.ilRpcClientFactory.php';
53  $xml = ilRpcClientFactory::factory('RPCSearchHandler')->searchMail(
54  CLIENT_ID . '_' . $ilSetting->get('inst_id', 0),
55  (int)$user_id,
56  (string)$this->query_parser->getQuery(),
57  (int)$mail_folder_id
58  );
59  }
60  catch(XML_RPC2_FaultException $e)
61  {
62  $ilBench->stop('Mail', 'LuceneSearch');
63  $ilLog->write(__METHOD__ . ': ' . $e->getMessage());
64  throw $e;
65  }
66  catch(Exception $e)
67  {
68 
69  $ilBench->stop('Mail', 'LuceneSearch');
70  $ilLog->write(__METHOD__ . ': ' . $e->getMessage());
71  throw $e;
72  }
73  $ilBench->stop('Mail', 'LuceneSearch');
74 
75  include_once 'Services/Mail/classes/class.ilMailSearchLuceneResultParser.php';
76  $parser = new ilMailSearchLuceneResultParser($this->result, $xml);
77  $parser->parse();
78  }
79 }