ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 141 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(), ilExerciseSearch\performSearch(), ilForumSearch\performSearch(), ilWebresourceSearch\performSearch(), ilGlossaryDefinitionSearch\performSearch(), ilMediaCastSearch\performSearch(), ilObjectSearch\performSearch(), ilUserSearch\performSearch(), and ilAdvancedMDSearch\performSearch().

142  {
143  global $ilDB;
144 
145  if ($this->query_parser->getCombination() == 'or') {
146  return '';
147  }
148  if (count($this->fields) > 1) {
149  foreach ($this->fields as $field) {
150  $tmp_fields[] = array($field,'text');
151  }
152  $complete_str = $ilDB->concat($tmp_fields);
153 
154  /*
155  $complete_str = 'CONCAT(';
156  $complete_str .= implode(',',$this->fields);
157  $complete_str .= ')';
158  */
159  } else {
160  $complete_str = $this->fields[0];
161  }
162 
163  $counter = 0;
164  foreach ($this->query_parser->getQuotedWords() as $word) {
165  $locate .= ',';
166  $locate .= $ilDB->locate($ilDB->quote($word, 'text'), $complete_str);
167  $locate .= (' found' . $counter++);
168  $locate .= ' ';
169  #$locate .= (", LOCATE('".$word."',".$complete_str.") ");
170  #$locate .= ("as found".$counter++." ");
171  }
172 
173  return $locate;
174  }
$errors fields
Definition: imgupload.php:51
$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 176 of file class.ilAbstractSearch.php.

References $counter, $row, and array.

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

177  {
178  if ($this->query_parser->getCombination() == 'or') {
179  return array();
180  }
181  $counter = 0;
182  foreach ($this->query_parser->getQuotedWords() as $word) {
183  $res_found = "found" . $counter++;
184  $found[] = $row->$res_found;
185  }
186  return $found ? $found : array();
187  }
$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 113 of file class.ilAbstractSearch.php.

References $a_type.

114  {
115  if (is_array($this->object_types)) {
116  if (in_array($a_type, $this->object_types)) {
117  return false;
118  }
119  }
120  $this->object_types[] = $a_type;
121 
122  return true;
123  }
$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 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:51
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 103 of file class.ilAbstractSearch.php.

References $id_filter, and array.

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

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

◆ performSearch()

ilAbstractSearch::performSearch ( )

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

190  {
191  echo "Should be overwritten.";
192  }

◆ 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  $this->object_types = $a_filter;
86  }
87  }

◆ setIdFilter()

ilAbstractSearch::setIdFilter (   $a_id_filter)

Set id filter Filters search by given object id.

Returns

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

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

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(), 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: