Package org.opencastproject.search.api
Interface SearchService
- All Known Implementing Classes:
SearchServiceImpl
public interface SearchService
Provides search capabilities, possibly to the engage tools, possibly to other services.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionadd(MediaPackage mediaPackage) Adds the media package to the search index.voidaddSynchronously(MediaPackage mediaPackage) Immediately adds the mediapackage to the search index.Removes the media package identified bymediaPackageIdfrom the search index.deleteSeries(String seriesId) Removes the series identified byseriseIdfrom the search index.booleandeleteSynchronously(String mediaPackageId) Immediately removes the given mediapackage from the search service.Gets theMediaPackagefor an event, based on its mediapackage ID.Collection<org.apache.commons.lang3.tuple.Pair<Organization, MediaPackage>> Returns a list ofOrganization,MediaPackagepairs of mediapackages within a series.search(org.elasticsearch.search.builder.SearchSourceBuilder searchSource) Searches the index based on aSearchSourceBuilder's query
-
Field Details
-
JOB_TYPE
Identifier for service registration and location- See Also:
-
-
Method Details
-
add
Job add(MediaPackage mediaPackage) throws SearchException, MediaPackageException, UnauthorizedException, ServiceRegistryException Adds the media package to the search index.- Parameters:
mediaPackage- the media package- Throws:
SearchException- if an error occurs while adding the media packageMediaPackageException- if an error occurs accessing the media packageUnauthorizedException- if the current user is not authorized to add this media package to the search indexServiceRegistryException- if the job for adding the mediapackage can not be created
-
getSeries
Collection<org.apache.commons.lang3.tuple.Pair<Organization,MediaPackage>> getSeries(String seriesId) Returns a list ofOrganization,MediaPackagepairs of mediapackages within a series. Note that the Organization should always be the same since series should not cross organizational bounds.- Parameters:
seriesId- the series ID to query- Returns:
- A list of
Organization,MediaPackagepairs of mediapackages within the series.
-
addSynchronously
void addSynchronously(MediaPackage mediaPackage) throws SearchException, IllegalArgumentException, UnauthorizedException Immediately adds the mediapackage to the search index.- Parameters:
mediaPackage- the media package- Throws:
SearchException- if the media package cannot be added to the search indexIllegalArgumentException- if the mediapackage isnullUnauthorizedException- if the user does not have the rights to add the mediapackage
-
delete
Removes the media package identified bymediaPackageIdfrom the search index.- Parameters:
mediaPackageId- id of the media package to remove- Returns:
trueif the episode was found and deleted- Throws:
SearchException- if an error occurs while removing the media packageUnauthorizedException- if the current user is not authorized to remove this mediapackage from the search indexNotFoundException
-
deleteSeries
Removes the series identified byseriseIdfrom the search index. Does *not* remove the associated events from the index!- Parameters:
seriesId- id of the series to remove- Returns:
trueif the series was found and deleted- Throws:
SearchException- if an error occurs while removing the seriesUnauthorizedException- if the current user is not authorized to remove this series from the search indexNotFoundException
-
deleteSynchronously
Immediately removes the given mediapackage from the search service.- Parameters:
mediaPackageId- the mediapackage- Returns:
trueif the mediapackage was deleted- Throws:
SearchException- if deletion failed
-
get
MediaPackage get(String mediaPackageId) throws NotFoundException, SearchException, UnauthorizedException Gets theMediaPackagefor an event, based on its mediapackage ID.- Parameters:
mediaPackageId- The ID of the mediapackage in question- Returns:
- The
MediaPackage - Throws:
NotFoundException- If the mediapackage is not found.SearchException- If an error occurs while searching for the mediapackage.UnauthorizedException- if the current user is not authorized to view this mediapackage.
-
search
SearchResultList search(org.elasticsearch.search.builder.SearchSourceBuilder searchSource) throws SearchException Searches the index based on aSearchSourceBuilder's query- Parameters:
searchSource- TheSearchSourceBuilderdefining the search query- Returns:
- A
SearchResultListof the search's results - Throws:
SearchException- If an error occurs while searching the index.
-