17 require_once SQ_INCLUDE_PATH.
'/asset_management.inc';
41 $this->vars[
'group_by'] = Array(
43 'type' =>
'selection',
44 'default' =>
'number',
45 'parameters' => Array(
47 'allow_empty' => FALSE,
49 'number' =>
'Standard',
50 'grouped' =>
'Custom Grouping',
55 $this->vars[
'sis_button_text'] = Array(
58 'default' =>
'Search',
59 'description' =>
'Text that would appear on the search in search submit button',
60 'is_contextable' => TRUE,
63 $this->vars[
'fields'] = Array(
65 'type' =>
'serialise',
67 'description' =>
'Search fields.',
70 $this->vars[
'categories'] = Array(
72 'type' =>
'serialise',
74 'description' =>
'Search categories.',
77 $this->vars[
'no_category_text'] = Array(
80 'default' =>
'No Category Selected',
81 'description' =>
'The text that appears for a "no category selected" options.',
82 'is_contextable' => TRUE,
85 $this->vars[
'auto_synonym_search_field'] = Array(
89 'description' =>
'Field to automatically search for synonyms on if the original search term(s) return no results. Empty string = auto synonym searching disabled',
92 $this->vars[
'search_types'] = Array(
94 'type' =>
'serialise',
96 'description' =>
'Searchable asset types',
99 $this->vars[
'search_styles'] = Array(
101 'type' =>
'serialise',
102 'default' => Array(),
103 'description' =>
'Styles of the search fields',
106 $this->vars[
'use_picker'] = Array(
110 'description' =>
'Use the JS date picker or not',
111 'parameters' => Array(
'allow_empty' => FALSE),
114 $this->vars[
'logic'] = Array(
116 'type' =>
'selection',
118 'description' =>
'Whether to include all or any fields.',
119 'parameters' => Array(
121 'allow_empty' => FALSE,
123 'AND' =>
'Match on ALL fields',
124 'OR' =>
'Match on at least ONE field',
129 $this->vars[
'allow_empty_search'] = Array(
133 'description' =>
'If true, empty search query will search for everything',
134 'parameters' => Array(
'allow_empty' => FALSE),
136 $this->vars[
'search_as_public_user'] = Array(
140 'description' =>
'If true, only look for assets which were granted public user read',
141 'parameters' => Array(
'allow_empty' => FALSE),
143 $this->vars[
'no_roles_check'] = Array(
147 'description' =>
'If true, search for assets without checking roles',
148 'parameters' => Array(
'allow_empty' => FALSE),
150 $this->vars[
'no_group_access_check'] = Array(
154 'description' =>
'If true, search for assets without checking groups access priviledge for current user',
155 'parameters' => Array(
'allow_empty' => FALSE),
159 $this->vars[
'spell_check_string'] = Array(
162 'default' =>
'Did you mean: %suggestions%',
163 'description' =>
'String to use for the "spell check suggestions" keyword',
164 'is_contextable' => TRUE,
167 $this->vars[
'synonym_string'] = Array(
170 'default' =>
'Did you mean: %suggestions%',
171 'description' =>
'String to use for the "synonyms" keyword',
172 'is_contextable' => TRUE,
175 $this->vars[
'auto_synonym_string'] = Array(
178 'default' =>
'(and related terms)',
179 'description' =>
'String to display for the "auto synonym search triggered" keyword',
180 'is_contextable' => TRUE,
183 $this->vars[
'stored_query_session'] = Array(
185 'type' =>
'parameter_map',
186 'default' => Array(),
187 'description' =>
'Use saved variables to conduct the search query',
188 'parameters' => Array(
189 'parameters' => Array(
190 'stored_query' =>
'Search all fields',
195 $this->vars[
'stored_query_show_results'] = Array(
199 'description' =>
'Go directly to the results if the query is stored',
200 'parameters' => Array(
'allow_empty' => FALSE),
204 $this->vars[
'sort_by'] = Array(
206 'type' =>
'serialise',
213 'name' =>
'Relevance',
224 'field' =>
'short_name',
227 'name' =>
'Short Name',
231 'field' =>
'created',
234 'name' =>
'Created Date',
238 'field' =>
'updated',
241 'name' =>
'Last Updated Date',
245 'field' =>
'published',
248 'name' =>
'Last Published Date',
252 'field' =>
'type_code',
254 'name' =>
'Asset Type',
267 $this->vars[
'enable_multi_word_synonym_lookups'] = Array(
271 'description' =>
'If true, a Thesaurus lookup will be performed for matching synonyms based on combinations of words from the search string',
272 'parameters' => Array(
'allow_empty' => FALSE),
275 $this->vars[
'exclude_self'] = Array(
279 'description' =>
'If true, only look for assets underneath root nodes',
280 'parameters' => Array(
'allow_empty' => FALSE),
282 $this->vars[
'restrict_date_field'] = Array(
284 'type' =>
'selection',
285 'default' =>
'updated',
286 'parameters' => Array(
288 'created' =>
'Created Date',
289 'updated' =>
'Last Updated Date',
290 'published' =>
'Last Published Date',
294 'allow_empty' => FALSE,
296 $this->vars[
'restrict_date_range_from'] = Array(
298 'type' =>
'datetime',
299 'default' =>
'---------- --:--:--',
300 'parameters' => Array(
301 'allow_null' => TRUE,
304 $this->vars[
'restrict_date_range_to'] = Array(
306 'type' =>
'datetime',
307 'default' =>
'---------- --:--:--',
308 'parameters' => Array(
309 'allow_null' => TRUE,
312 $this->vars[
'page_link_format'] = Array(
315 'default' =>
' <a href="%page_link%">%page_number%</a>',
318 $this->vars[
'current_page_format'] = Array(
321 'default' =>
' <b>%page_number%</b>',
323 $this->vars[
'disable_keyword_replacements'] = Array(
327 'description' =>
'If true, will not replace any keywords from the user input',
328 'parameters' => Array(
'allow_empty' => FALSE),
344 'event_name' =>
'requestKeywords',
345 'broadcast_type_code' =>
'content_type',
346 'broadcast_strict_type_code' => FALSE,
348 'side_of_link' =>
'major',
350 'is_exclusive' => NULL,
353 'link_type' => SQ_LINK_TYPE_2 | SQ_LINK_TYPE_1,
371 parent::_upgrade($current_version);
373 if (version_compare($current_version,
'0.26',
'<')) {
374 echo(
'UPGRADING SEARCH PAGE FROM '.$current_version.
"\n");
382 $GLOBALS[
'SQ_SYSTEM']->changeDatabaseConnection(
'db2');
383 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'BEGIN');
385 pre_echo(
'Updating Search Pages...');
388 $search_pages = $GLOBALS[
'SQ_SYSTEM']->am->getTypeAssetids(
'search_page', FALSE, TRUE);
391 foreach ($search_pages as $id => $type) {
392 $search_page = $GLOBALS[
'SQ_SYSTEM']->am->getAsset($id);
394 $old_fields = $search_page->attr(
'fields');
395 $new_fields = Array();
396 foreach($old_fields as $field_name => $field_data) {
398 if (isset($field_data[
'data_sources'][0][
'type']) && $field_data[
'data_sources'][0][
'type'] ==
'exclude') {
399 $new_fields[$field_name][
'name'] = $field_name;
400 $new_fields[$field_name][
'word_logic'] =
'OR';
401 $new_fields[$field_name][
'exclude_field'] = TRUE;
402 $new_fields[$field_name][
'data_sources'] = Array(
404 'type' =>
'include_all',
409 $new_fields[$field_name] = $field_data;
410 $new_fields[$field_name][
'exclude_field'] = FALSE;
414 $GLOBALS[
'SQ_SYSTEM']->setRunLevel(SQ_RUN_LEVEL_FORCED);
415 $search_page->setAttrValue(
'fields', $new_fields);
417 if (!$search_page->saveAttributes()) {
418 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'ROLLBACK');
419 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
421 pre_echo(
'UPGRADE FAILED - Could not save attributes');
424 $GLOBALS[
'SQ_SYSTEM']->restoreRunLevel();
426 $GLOBALS[
'SQ_SYSTEM']->am->forgetAsset($search_pages, TRUE);
427 unset($search_pages);
432 pre_echo(
'Updated - '.$count.
' search page(s)...');
434 $GLOBALS[
'SQ_SYSTEM']->doTransaction(
'COMMIT');
435 $GLOBALS[
'SQ_SYSTEM']->restoreDatabaseConnection();
437 pre_echo(
'SEARCH PAGES SUCCESSFULLY UPGRADED TO VERSION 0.26');