You are here

public function AcquiaDAM_Search::search in Media: Acquia DAM 7

Issue a search.

Parameters

string $phrase: The keywords to search for.

array $options: An array of options to pass to to the API request.

Return value

array The result of the search request.

File

src/AcquiaDAM/AcquiaDAM_Search.inc, line 42

Class

AcquiaDAM_Search
Acquia DAM Search requests.

Code

public function search($phrase, array $options = []) {
  $options += [
    'query' => $phrase,
    'folderid' => NULL,
    'sortby' => 'datecreated',
    'sortdir' => 'asc',
    'limit' => 50,
    'offset' => 0,
    'types' => '',
    'searchfield' => '',
    'facets' => 'all',
  ];
  if (is_array($options['types'])) {
    $options['types'] = implode(',', $options['types']);
  }
  return $this->depends['client']
    ->request('search', $options);
}