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

Public Member Functions

 __construct ($qp_obj)
 Constructor public. More...
 
 setFields ($a_fields)
 Set fields to search. More...
 
 getFields ()
 Get fields to search. More...
 
 setFilter ($a_filter)
 set object type to search in More...
 
 setIdFilter ($a_id_filter)
 Set id filter Filters search by given object id. More...
 
 getIdFilter ()
 Get Id filter. More...
 
 appendToFilter ($a_type)
 Append object type to filter. More...
 
 getFilter ()
 get object type to search in More...
 
 __createLocateString ()
 build locate string in case of AND search More...
 
 __prepareFound (&$row)
 
 performSearch ()
 

Data Fields

 $db = null
 
 $query_parser = null
 
 $search_result = null
 
 $object_types
 

Private Attributes

 $id_filter = array()
 

Detailed Description

Definition at line 16 of file class.ilAbstractSearch.php.

Constructor & Destructor Documentation

◆ __construct()

ilAbstractSearch::__construct (   $qp_obj)

Constructor public.

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

References $DIC, and $ilDB.

46  {
47  global $DIC;
48 
49  $ilDB = $DIC['ilDB'];
50 
51  $this->query_parser = $qp_obj;
52  $this->db = $ilDB;
53 
54  include_once 'Services/Search/classes/class.ilSearchResult.php';
55 
56  $this->search_result = new ilSearchResult();
57  }
global $DIC
Definition: saml.php:7
global $ilDB

Member Function Documentation

◆ __createLocateString()

ilAbstractSearch::__createLocateString ( )

build locate string in case of AND search

Returns
string public

Definition at line 143 of file class.ilAbstractSearch.php.

References $DIC, $ilDB, and fields.

Referenced by ilMetaDataSearch\__searchContribute(), ilMetaDataSearch\__searchDescriptions(), ilAdvancedSearch\__searchEntity(), ilAdvancedSearch\__searchGeneral(), ilAdvancedSearch\__searchKeyword(), ilMetaDataSearch\__searchKeywords(), ilAdvancedSearch\__searchLifecycle(), ilTestSearch\__searchSurveyIntroduction(), ilTestSearch\__searchSurveyTitle(), ilAdvancedSearch\__searchTaxon(), ilTestSearch\__searchTestIntroduction(), ilTestSearch\__searchTestTitle(), ilAdvancedSearch\__searchTitleDescription(), ilMetaDataSearch\__searchTitles(), ilMediaPoolSearch\performKeywordSearch(), ilUserDefinedFieldSearch\performSearch(), ilMediaPoolSearch\performSearch(), ilLikeUserOrgUnitSearch\performSearch(), ilLikeUserMultiFieldSearch\performSearch(), ilWikiContentSearch\performSearch(), ilLMContentSearch\performSearch(), ilExerciseSearch\performSearch(), ilForumSearch\performSearch(), ilWebresourceSearch\performSearch(), ilGlossaryDefinitionSearch\performSearch(), ilMediaCastSearch\performSearch(), ilObjectSearch\performSearch(), ilUserSearch\performSearch(), and ilAdvancedMDSearch\performSearch().

144  {
145  global $DIC;
146 
147  $ilDB = $DIC['ilDB'];
148 
149  if ($this->query_parser->getCombination() == 'or') {
150  return '';
151  }
152  if (count($this->fields) > 1) {
153  foreach ($this->fields as $field) {
154  $tmp_fields[] = array($field,'text');
155  }
156  $complete_str = $ilDB->concat($tmp_fields);
157 
158  /*
159  $complete_str = 'CONCAT(';
160  $complete_str .= implode(',',$this->fields);
161  $complete_str .= ')';
162  */
163  } else {
164  $complete_str = $this->fields[0];
165  }
166 
167  $counter = 0;
168  foreach ($this->query_parser->getQuotedWords() as $word) {
169  $locate .= ',';
170  $locate .= $ilDB->locate($ilDB->quote($word, 'text'), $complete_str);
171  $locate .= (' found' . $counter++);
172  $locate .= ' ';
173  #$locate .= (", LOCATE('".$word."',".$complete_str.") ");
174  #$locate .= ("as found".$counter++." ");
175  }
176 
177  return $locate;
178  }
global $DIC
Definition: saml.php:7
$errors fields
Definition: imgupload.php:51
global $ilDB
+ Here is the caller graph for this function:

◆ __prepareFound()

ilAbstractSearch::__prepareFound ( $row)

Definition at line 180 of file class.ilAbstractSearch.php.

References $row.

Referenced by ilAdvancedSearch\__searchEntity(), ilAdvancedSearch\__searchGeneral(), ilAdvancedSearch\__searchKeyword(), ilAdvancedSearch\__searchLifecycle(), and ilAdvancedSearch\__searchTaxon().

181  {
182  if ($this->query_parser->getCombination() == 'or') {
183  return array();
184  }
185  $counter = 0;
186  foreach ($this->query_parser->getQuotedWords() as $word) {
187  $res_found = "found" . $counter++;
188  $found[] = $row->$res_found;
189  }
190  return $found ? $found : array();
191  }
$row
+ Here is the caller graph for this function:

◆ appendToFilter()

ilAbstractSearch::appendToFilter (   $a_type)

Append object type to filter.

Parameters
stringobj_type e.g. 'role' public

Definition at line 115 of file class.ilAbstractSearch.php.

References $a_type.

116  {
117  if (is_array($this->object_types)) {
118  if (in_array($a_type, $this->object_types)) {
119  return false;
120  }
121  }
122  $this->object_types[] = $a_type;
123 
124  return true;
125  }
$a_type
Definition: workflow.php:92

◆ getFields()

ilAbstractSearch::getFields ( )

Get fields to search.

Returns
array array of search fields. E.g. array(title,description) public

Definition at line 74 of file class.ilAbstractSearch.php.

References fields.

Referenced by ilLikeUserDefinedFieldSearch\__createWhereCondition(), ilLikeUserSearch\__createWhereCondition(), ilLikeTestSearch\__createWhereCondition(), ilLikeUserMultiFieldSearch\__createWhereCondition(), ilTestSearch\__searchSurveyIntroduction(), ilTestSearch\__searchSurveyTitle(), ilTestSearch\__searchTestIntroduction(), and ilTestSearch\__searchTestTitle().

75  {
76  return $this->fields ? $this->fields : array();
77  }
$errors fields
Definition: imgupload.php:51
+ Here is the caller graph for this function:

◆ getFilter()

◆ getIdFilter()

ilAbstractSearch::getIdFilter ( )

Get Id filter.

Returns

Definition at line 105 of file class.ilAbstractSearch.php.

References $id_filter.

Referenced by ilWikiContentSearch\__createInStatement(), ilLMContentSearch\__createInStatement(), and ilObjectSearch\__createInStatement().

106  {
107  return (array) $this->id_filter;
108  }
+ Here is the caller graph for this function:

◆ performSearch()

ilAbstractSearch::performSearch ( )

Definition at line 193 of file class.ilAbstractSearch.php.

194  {
195  echo "Should be overwritten.";
196  }

◆ setFields()

◆ setFilter()

ilAbstractSearch::setFilter (   $a_filter)

set object type to search in

Parameters
arrayArray of object types (e.g array('lm','st','pg','dbk')) public

Definition at line 84 of file class.ilAbstractSearch.php.

85  {
86  if (is_array($a_filter)) {
87  $this->object_types = $a_filter;
88  }
89  }

◆ setIdFilter()

ilAbstractSearch::setIdFilter (   $a_id_filter)

Set id filter Filters search by given object id.

Returns

Definition at line 96 of file class.ilAbstractSearch.php.

97  {
98  $this->id_filter = $a_id_filter;
99  }

Field Documentation

◆ $db

ilAbstractSearch::$db = null

Definition at line 21 of file class.ilAbstractSearch.php.

◆ $id_filter

ilAbstractSearch::$id_filter = array()
private

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

Referenced by getIdFilter().

◆ $object_types

ilAbstractSearch::$object_types
Initial value:
= array('cat','dbk','crs','fold','frm','grp','lm','sahs','glo','mep','htlm','exc','file','qpl','tst','svy','spl',
'chat','webr','mcst','sess','pg','st','wiki','book', 'copa')

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

◆ $query_parser

ilAbstractSearch::$query_parser = null

Definition at line 25 of file class.ilAbstractSearch.php.

Referenced by ilAdvancedMDSearch\__construct().

◆ $search_result

ilAbstractSearch::$search_result = null

Definition at line 30 of file class.ilAbstractSearch.php.

Referenced by ilAdvancedSearch\__searchClassification(), ilMetaDataSearch\__searchContribute(), ilAdvancedSearch\__searchContribute(), ilMetaDataSearch\__searchDescriptions(), ilAdvancedSearch\__searchEducational(), ilAdvancedSearch\__searchEntity(), ilAdvancedSearch\__searchFormat(), ilAdvancedSearch\__searchGeneral(), ilAdvancedSearch\__searchKeyword(), ilMetaDataSearch\__searchKeywords(), ilAdvancedSearch\__searchLanguage(), ilAdvancedSearch\__searchLifecycle(), ilAdvancedSearch\__searchRequirement(), ilAdvancedSearch\__searchRights(), ilTestSearch\__searchSurveyIntroduction(), ilTestSearch\__searchSurveyTitle(), ilAdvancedSearch\__searchTaxon(), ilTestSearch\__searchTestIntroduction(), ilTestSearch\__searchTestTitle(), ilAdvancedSearch\__searchTitleDescription(), ilMetaDataSearch\__searchTitles(), ilAdvancedSearch\__searchTypicalAgeRange(), ilMediaPoolSearch\performKeywordSearch(), ilUserDefinedFieldSearch\performSearch(), ilMediaPoolSearch\performSearch(), ilLikeUserMultiFieldSearch\performSearch(), ilLikeUserOrgUnitSearch\performSearch(), ilWikiContentSearch\performSearch(), ilExerciseSearch\performSearch(), ilForumSearch\performSearch(), ilWebresourceSearch\performSearch(), ilGlossaryDefinitionSearch\performSearch(), ilLMContentSearch\performSearch(), ilMediaCastSearch\performSearch(), ilObjectSearch\performSearch(), ilUserSearch\performSearch(), ilAdvancedMDSearch\performSearch(), and ilTestSearch\performSearch().


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