ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilMDSearch Class Reference
+ Collaboration diagram for ilMDSearch:

Public Member Functions

 __construct ($qp_obj)
 Constructor public. More...
 
 setMode ($a_mode)
 Define meta elements to search. More...
 
 getMode ()
 
performSearch ()
 
 __searchKeywordsOnly ()
 

Data Fields

 $mode = ''
 
 $query_parser = null
 
 $db = null
 

Detailed Description

Definition at line 36 of file class.ilMDSearch.php.

Constructor & Destructor Documentation

◆ __construct()

ilMDSearch::__construct (   $qp_obj)

Constructor public.

Definition at line 51 of file class.ilMDSearch.php.

References $DIC, and $ilDB.

52  {
53  global $DIC;
54 
55  $ilDB = $DIC['ilDB'];
56 
57  $this->query_parser = $qp_obj;
58  $this->db = $ilDB;
59 
60  include_once 'Services/Search/classes/class.ilSearchResult.php';
61 
62  $this->search_result = new ilSearchResult();
63  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ __searchKeywordsOnly()

ilMDSearch::__searchKeywordsOnly ( )

Definition at line 99 of file class.ilMDSearch.php.

References $ilDB, $query, $res, $row, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by performSearch().

100  {
101  $where = " WHERE ";
102  $field = " keyword ";
103  $counter = 0;
104  foreach ($this->query_parser->getQuotedWords() as $word) {
105  if ($counter++) {
106  $where .= strtoupper($this->query_parser->getCombination());
107  }
108  $where .= $field;
109  $where .= ("LIKE (" . $ilDB->quote("%" . $word . "%") . ")");
110  }
111 
112  $query = "SELECT * FROM il_meta_keyword" .
113  $where .
114  "ORDER BY meta_keyword_id DESC";
115 
116  $res = $this->db->query($query);
117  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
118  $this->search_result->addEntry($row->obj_id, $row->obj_type, $row->rbac_id);
119  }
120 
121  return $this->search_result;
122  }
foreach($_POST as $key=> $value) $res
$query
$row
global $ilDB
+ Here is the caller graph for this function:

◆ getMode()

ilMDSearch::getMode ( )

Definition at line 75 of file class.ilMDSearch.php.

References $mode.

Referenced by performSearch().

76  {
77  return $this->mode;
78  }
+ Here is the caller graph for this function:

◆ performSearch()

& ilMDSearch::performSearch ( )

Definition at line 81 of file class.ilMDSearch.php.

References __searchKeywordsOnly(), and getMode().

82  {
83  switch ($this->getMode()) {
84  case 'all':
85  break;
86  case 'keyword':
87  return $this->__searchKeywordsOnly();
88  break;
89 
90  default:
91  echo "ilMDSearch::performSearch() no mode given";
92  return false;
93  }
94  }
+ Here is the call graph for this function:

◆ setMode()

ilMDSearch::setMode (   $a_mode)

Define meta elements to search.

Parameters
stringmode keyword or all public

Definition at line 71 of file class.ilMDSearch.php.

72  {
73  $this->mode = $a_mode;
74  }

Field Documentation

◆ $db

ilMDSearch::$db = null

Definition at line 45 of file class.ilMDSearch.php.

◆ $mode

ilMDSearch::$mode = ''

Definition at line 38 of file class.ilMDSearch.php.

Referenced by getMode().

◆ $query_parser

ilMDSearch::$query_parser = null

Definition at line 43 of file class.ilMDSearch.php.


The documentation for this class was generated from the following file: