Example #1
0
 /**
  * This function is the global search
  * @param $api ServiceBase The API class of the request
  * @param $args array The arguments array passed in from the API
  * @return array result set
  */
 public function globalSearch(ServiceBase $api, array $args)
 {
     $api->action = 'list';
     // This is required to keep the loadFromRow() function in the bean from making our day harder than it already is.
     $GLOBALS['disable_date_format'] = true;
     $search = new UnifiedSearchApi();
     $options = $search->parseSearchOptions($api, $args);
     $options['custom_where'] = $this->getCustomWhereForModule($args['module_list']);
     $searchEngine = new SugarSpot();
     $options['resortResults'] = true;
     $recordSet = $search->globalSearchSpot($api, $args, $searchEngine, $options);
     return $recordSet;
 }
Example #2
0
 public function filterList(ServiceBase $api, array $args, $acl = 'list')
 {
     if (!empty($args['q'])) {
         if (!empty($args['filter']) || !empty($args['deleted'])) {
             // These flags can be used with the filter API, but not with the search API
             throw new SugarApiExceptionInvalidParameter();
         }
         // We need to use unified search for this for compatibilty with Nomad
         require_once 'clients/base/api/UnifiedSearchApi.php';
         $search = new UnifiedSearchApi();
         $args['module_list'] = $args['module'];
         return $search->globalSearch($api, $args);
     }
     list($args, $q, $options, $seed) = $this->filterListSetup($api, $args, $acl);
     $api->action = 'list';
     return $this->runQuery($api, $args, $q, $options, $seed);
 }