Skip to content

OcSearch

FarbodZamani edited this page Mar 28, 2022 · 4 revisions

This class contains a few REST API call to the /search endpoint including {episode | lucene | series}.{json | xml}.

Namespace

It is accessible under OpencastApi\Rest namespace.

How to use

  1. In OpencastApi\OpenCast as its property with OpenCast properties naming convention:
use OpencastApi\OpenCast;
// Single Node Opencast...
$opencastApi = new OpenCast($config);
$ocSearch = $opencastApi->search;
...

EXTRA: If you are using a dual node Opencast (one for admin and the other one for engage node including presentation/search), you might have to pass an extra parameter called $engageConfig to the OpencastApi\OpenCast when creating the instance like following:

use OpencastApi\OpenCast;
// Dual node Opencast
$config = [/*the config for admin node*/];
$engageConfig = [/*the config for engage node*/];

$opencastApi = new OpenCast($config, $engageConfig);
$ocSearch = $opencastApi->search;
...
  1. Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcSearch;
$engageConfig = [/*the config for engage node*/];
$ocRestClient = new OcRestClient($engageConfig);
$ocSearch = new OcSearch($ocRestClient);
...

Functions

Consumable functions are liested below:

getEpisodes($params = [], $format = '')

Search for episodes matching the query parameters as object (JSON) by default or XML (text) on demand. More Detail

  • $params is an optional array that could contain the following:
[
    'id' => '{The ID of the single episode to be returned, if it exists}',
    'q' => '{Any episode that matches this free-text query.}',
    'sid' => '{Any episode that belongs to specified series id.}',
    'sname' => '{ Any episode that belongs to specified series name (note that the specified series name must be unique).}',
    'sort' => '{The sort order. May include any of the following: DATE_CREATED, DATE_MODIFIED, TITLE, SERIES_ID, MEDIA_PACKAGE_ID, CREATOR, CONTRIBUTOR, LANGUAGE, LICENSE, SUBJECT, DESCRIPTION, PUBLISHER. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC).}',
    'limit' => '{ The maximum number of items to return per page. (Default value=20)}',
    'offset' => '{The page number. (Default value=0)}',
    'admin' => '{Whether this is an administrative query (Default value=false)}',
    'sign' => '{If results are to be signed (Default value=true)}',
]
  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{The search results, formatted as xml or json}']

getLucene($params = [], $format = '')

Search a lucene query as object (JSON) by default or XML (text) on demand. More Detail

  • $params is an optional array that could contain the following:
[
    'q' => '{ The lucene query. }',
    'series' => '{ Include series in the search result. (Default value=false)}',
    'sort' => '{ The sort order. May include any of the following: DATE_CREATED, DATE_MODIFIED, TITLE, SERIES_ID, MEDIA_PACKAGE_ID, CREATOR, CONTRIBUTOR, LANGUAGE, LICENSE, SUBJECT, DESCRIPTION, PUBLISHER. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC).}',
    'limit' => '{ The maximum number of items to return per page. (Default value=20)}',
    'offset' => '{The page number. (Default value=0)}',
    'admin' => '{Whether this is an administrative query (Default value=false)}',
    'sign' => '{If results are to be signed (Default value=true)}',
]
  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{The search results, formatted as xml or json}']

getSeries($params = [], $format = '')

Search for series matching the query parameters and returns JSON (object) by default or XML (text) on demand. More Detail

  • $params is an optional array that could contain the following:
[
    'id' = '{The series ID. If the additional boolean parameter "episodes" is "true", the result set will include this series episodes.}'
    'q' => '{Any series that matches this free-text query. If the additional boolean parameter "episodes" is "true", the result set will include this series episodes.}',
    'episodes' => '{ Whether to include this series episodes. This can be used in combination with "id" or "q". (Default value=false)}',
    'sort' => '{ The sort order. May include any of the following: DATE_CREATED, DATE_MODIFIED, TITLE, SERIES_ID, MEDIA_PACKAGE_ID, CREATOR, CONTRIBUTOR, LANGUAGE, LICENSE, SUBJECT, DESCRIPTION, PUBLISHER. Add '_DESC' to reverse the sort order (e.g. TITLE_DESC). }',
    'limit' => '{ The maximum number of items to return per page. (Default value=20)}',
    'offset' => '{The page number. (Default value=0)}',
    'admin' => '{Whether this is an administrative query (Default value=false)}',
    'sign' => '{If results are to be signed (Default value=true)}',
]
  • $format (string) (optional) The output format (json or xml) of the response body. (Default value = 'json')

  • Returns an array: ['code' => 200, 'body' => '{The search results, formatted as xml or json}']