/** * Process search query and display suggestion as a JSON object. * * @return void * @access public */ public function getSuggestions() { $autocomplete = true; $prefilters = getExtraConfigArray('prefilters'); if (isset($_REQUEST['prefilter']) && $_REQUEST['prefilter'] && isset($prefilters[$_REQUEST['prefilter']])) { $prefilter = $prefilters[$_REQUEST['prefilter']]; if ($prefilter && $_REQUEST['prefilter'] != '-') { $params = $_REQUEST; $params['prefiltered'] = $params['prefilter']; unset($params['prefilter']); foreach ($prefilter as $key => $value) { if ($key == 'module' || $key == 'action') { if ($key == 'module' && ($value != 'Search' && $value != 'Browse')) { // only autocomplete on local index and browse $autocomplete = false; break; } continue; } if (is_array($value)) { foreach ($value as $v) { $params[$key][] = $v; } } else { $params[$key] = $value; } } $_REQUEST = $params; } } if ($autocomplete) { $this->output(array_values(AutocompleteFactory::getSuggestions()), JSON::STATUS_OK); } else { $this->output('', JSON::STATUS_ERROR); } }
/** * Process incoming parameters and display suggestions. * * @return void * @access public */ public function launch() { // Display suggestions: echo implode("\n", AutocompleteFactory::getSuggestions()); }
/** * Process search query and display suggestion as a JSON object. * * @return void * @access public */ public function getSuggestions() { $this->output(array_values(AutocompleteFactory::getSuggestions()), JSON::STATUS_OK); }