SearchApi
class SearchApi implements JsonSerializable
Class SearchApi
The Cloudinary API search method allows you fine control on filtering and retrieving information on all the assets in your cloud with the help of query expressions in a Lucene-like query language. A few examples of what you can accomplish using the search method include:
- Searching by descriptive attributes such as public ID, filename, folders, tags, context, etc.
- Searching by file details such as type, format, file size, dimensions, etc.
- Searching by embedded data such as Exif, XMP, etc.
- Searching by analyzed data such as the number of faces, predominant colors, auto-tags, etc.
- Requesting aggregation counts on specified parameters, for example the number of assets found broken down by file format.
Methods
SearchApi constructor.
Sets the query string for filtering the assets in your cloud.
Sets the maximum number of results to return.
When a search request has more results to return than max_results, the next_cursor value is returned as part of the response.
Sets the sort_by
field.
The name of a field (attribute) for which an aggregation count should be calculated and returned in the response.
The name of an additional asset attribute to include for each asset in the response.
Executes the search API request asynchronously.
Executes the search API request.
Returns the query as an array.
No description
Details
__construct(mixed $configuration = null)
SearchApi constructor.
$this
expression(mixed $value)
Sets the query string for filtering the assets in your cloud.
If this parameter is not provided then all assets are listed (up to max_results).
$this
maxResults(int $value)
Sets the maximum number of results to return.
$this
nextCursor(string $value)
When a search request has more results to return than max_results, the next_cursor value is returned as part of the response.
You can then specify this value as the next_cursor parameter of the following request.
$this
sortBy(string $fieldName, string $dir = 'desc')
Sets the sort_by
field.
$this
aggregate(string $value)
The name of a field (attribute) for which an aggregation count should be calculated and returned in the response.
(Tier 2 only).
You can specify more than one aggregate parameter.
$this
withField(string $value)
The name of an additional asset attribute to include for each asset in the response.
PromiseInterface
executeAsync()
Executes the search API request asynchronously.
ApiResponse
execute()
Executes the search API request.
array
asArray()
Returns the query as an array.
jsonSerialize()
Constants
SEARCH_API_ENDPOINT |
|
SORT_BY |
|
AGGREGATE |
|
WITH_FIELD |
|
EXPRESSION |
|
MAX_RESULTS |
|
NEXT_CURSOR |
|
KEYS_WITH_UNIQUE_VALUES |
|