-
Notifications
You must be signed in to change notification settings - Fork 3
OcSearch
This class contains a few REST API call to the /search
endpoint including {episode | lucene | series}.{json | xml}
.
It is accessible under OpencastApi\Rest
namespace.
- 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;
...
- Direct instantiation:
use OpencastApi\Rest\OcRestClient;
use OpencastApi\Rest\OcSearch;
$engageConfig = [/*the config for engage node*/];
$ocRestClient = new OcRestClient($engageConfig);
$ocSearch = new OcSearch($ocRestClient);
...
Consumable functions are liested below:
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}']
NOTE (v1.7.0): As lucene search is removed in Opencast 16, therefore, this method is also disabled and return code 410.
If you would like to use this method and you have older Opencast you would need to pass 'features' => ['lucene' => true]
as the configuration to the Opencast instance.
$config = [
...
'features' => [
...
'lucene' => true
]
];
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}']
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}']