ILIAS  release_8 Revision v8.24
ilMDSearch Class Reference
+ Collaboration diagram for ilMDSearch:

Public Member Functions

 __construct (ilQueryParser $qp_obj)
 
 setMode (string $a_mode)
 
 getMode ()
 
 performSearch ()
 
 __searchKeywordsOnly ()
 

Private Attributes

string $mode = ''
 
ilQueryParser $query_parser
 
ilDBInterface $db
 
ilSearchResult $search_result
 

Detailed Description

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

Constructor & Destructor Documentation

◆ __construct()

ilMDSearch::__construct ( ilQueryParser  $qp_obj)

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

42 {
43 global $DIC;
44
45 $this->query_parser = $qp_obj;
46 $this->db = $DIC->database();
47 $this->search_result = new ilSearchResult();
48 }
global $DIC
Definition: feed.php:28

References $DIC.

Member Function Documentation

◆ __searchKeywordsOnly()

ilMDSearch::__searchKeywordsOnly ( )

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

77 {
78 $where = " WHERE ";
79 $field = " keyword ";
80 $counter = 0;
81 foreach ($this->query_parser->getQuotedWords() as $word) {
82 if ($counter++) {
83 $where .= strtoupper($this->query_parser->getCombination());
84 }
85 $where .= $field;
86 $where .= ("LIKE (" . $this->db->quote("%" . $word . "%", ilDBConstants::T_TEXT) . ")");
87 }
88
89 $query = "SELECT * FROM il_meta_keyword" .
90 $where .
91 "ORDER BY meta_keyword_id DESC";
92
93 $res = $this->db->query($query);
94 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
95 $this->search_result->addEntry($row->obj_id, $row->obj_type, $row->rbac_id);
96 }
98 }
ilSearchResult $search_result
$res
Definition: ltiservices.php:69
$query

References $query, $res, $search_result, ilDBConstants\FETCHMODE_OBJECT, and ilDBConstants\T_TEXT.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ getMode()

ilMDSearch::getMode ( )

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

55 : string
56 {
57 return $this->mode;
58 }

References $mode.

Referenced by performSearch().

+ Here is the caller graph for this function:

◆ performSearch()

ilMDSearch::performSearch ( )

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

61 {
62 switch ($this->getMode()) {
63 case 'all':
64 break;
65 case 'keyword':
66 return $this->__searchKeywordsOnly();
67 break;
68
69 default:
70 echo "ilMDSearch::performSearch() no mode given";
71 return null;
72 }
73 return null;
74 }

References __searchKeywordsOnly(), and getMode().

+ Here is the call graph for this function:

◆ setMode()

ilMDSearch::setMode ( string  $a_mode)

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

50 : void
51 {
52 $this->mode = $a_mode;
53 }

Field Documentation

◆ $db

ilDBInterface ilMDSearch::$db
private

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

◆ $mode

string ilMDSearch::$mode = ''
private

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

Referenced by getMode().

◆ $query_parser

ilQueryParser ilMDSearch::$query_parser
private

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

◆ $search_result

ilSearchResult ilMDSearch::$search_result
private

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

Referenced by __searchKeywordsOnly().


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