ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 $ilDB.

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

Member Function Documentation

◆ __searchKeywordsOnly()

ilMDSearch::__searchKeywordsOnly ( )

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

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

Referenced by performSearch().

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

◆ getMode()

ilMDSearch::getMode ( )

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

References $mode.

Referenced by performSearch().

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

◆ performSearch()

& ilMDSearch::performSearch ( )

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

References __searchKeywordsOnly(), and getMode().

80  {
81  switch($this->getMode())
82  {
83  case 'all':
84  break;
85  case 'keyword':
86  return $this->__searchKeywordsOnly();
87  break;
88 
89  default:
90  echo "ilMDSearch::performSearch() no mode given";
91  return false;
92  }
93  }
+ 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 69 of file class.ilMDSearch.php.

70  {
71  $this->mode = $a_mode;
72  }

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: