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

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

Member Function Documentation

◆ __createLocateString()

ilAbstractSearch::__createLocateString ( )

build locate string in case of AND search

Returns
string public

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

References $counter, $ilDB, array, 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(), ilGlossaryDefinitionSearch\performSearch(), ilMediaCastSearch\performSearch(), ilForumSearch\performSearch(), ilExerciseSearch\performSearch(), ilWebresourceSearch\performSearch(), ilObjectSearch\performSearch(), ilUserSearch\performSearch(), and ilAdvancedMDSearch\performSearch().

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

◆ __prepareFound()

ilAbstractSearch::__prepareFound ( $row)

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

References $counter, $row, and array.

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

186  {
187  if($this->query_parser->getCombination() == 'or')
188  {
189  return array();
190  }
191  $counter = 0;
192  foreach($this->query_parser->getQuotedWords() as $word)
193  {
194  $res_found = "found".$counter++;
195  $found[] = $row->$res_found;
196  }
197  return $found ? $found : array();
198  }
$counter
Create styles array
The data for the language used.
+ 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 114 of file class.ilAbstractSearch.php.

References $a_type.

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

◆ getFields()

ilAbstractSearch::getFields ( )

Get fields to search.

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

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

References array, and fields.

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

73  {
74  return $this->fields ? $this->fields : array();
75  }
$errors fields
Definition: imgupload.php:52
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ getFilter()

◆ getIdFilter()

ilAbstractSearch::getIdFilter ( )

Get Id filter.

Returns

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

References $id_filter, and array.

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

105  {
106  return (array) $this->id_filter;
107  }
Create styles array
The data for the language used.
+ Here is the caller graph for this function:

◆ performSearch()

& ilAbstractSearch::performSearch ( )

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

201  {
202  echo "Should be overwritten.";
203  }

◆ 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 82 of file class.ilAbstractSearch.php.

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

◆ setIdFilter()

ilAbstractSearch::setIdFilter (   $a_id_filter)

Set id filter Filters search by given object id.

Returns

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

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

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')

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(), ilGlossaryDefinitionSearch\performSearch(), ilMediaCastSearch\performSearch(), ilLMContentSearch\performSearch(), ilExerciseSearch\performSearch(), ilForumSearch\performSearch(), ilWebresourceSearch\performSearch(), ilObjectSearch\performSearch(), ilUserSearch\performSearch(), ilAdvancedMDSearch\performSearch(), and ilTestSearch\performSearch().


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