ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilMDSearch Class Reference
+ Collaboration diagram for ilMDSearch:

Public Member Functions

 __construct ($qp_obj)
 Constructor @access 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 @access public.

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

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

References $ilDB.

Member Function Documentation

◆ __searchKeywordsOnly()

ilMDSearch::__searchKeywordsOnly ( )

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

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

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

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ getMode()

ilMDSearch::getMode ( )

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

74 {
75 return $this->mode;
76 }

References $mode.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ performSearch()

& ilMDSearch::performSearch ( )

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

80 {
81 switch ($this->getMode()) {
82 case 'all':
83 break;
84 case 'keyword':
85 return $this->__searchKeywordsOnly();
86 break;
87
88 default:
89 echo "ilMDSearch::performSearch() no mode given";
90 return false;
91 }
92 }

References __searchKeywordsOnly(), and getMode().

+ Here is the call graph for this function:

◆ setMode()

ilMDSearch::setMode (   $a_mode)

Define meta elements to search.

Parameters
stringmode keyword or all @access 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: