Search in sources :

Example 1 with SeriesQueryBuilder

use of org.opencastproject.index.service.impl.index.series.SeriesQueryBuilder in project opencast by opencast.

the class AbstractSearchIndex method getByQuery.

/**
 * @param query
 *          The query to use to retrieve the series that match the query
 * @return {@link SearchResult} collection of {@link Series} from a query.
 * @throws SearchIndexException
 *           Thrown if there is an error getting the results.
 */
public SearchResult<Series> getByQuery(SeriesSearchQuery query) throws SearchIndexException {
    logger.debug("Searching index using series query '{}'", query);
    // Create the request builder
    SearchRequestBuilder requestBuilder = getSearchRequestBuilder(query, new SeriesQueryBuilder(query));
    try {
        return executeQuery(query, requestBuilder, new Fn<SearchMetadataCollection, Series>() {

            @Override
            public Series apply(SearchMetadataCollection metadata) {
                try {
                    return SeriesIndexUtils.toSeries(metadata);
                } catch (IOException e) {
                    return chuck(e);
                }
            }
        });
    } catch (Throwable t) {
        throw new SearchIndexException("Error querying series index", t);
    }
}
Also used : Series(org.opencastproject.index.service.impl.index.series.Series) SeriesQueryBuilder(org.opencastproject.index.service.impl.index.series.SeriesQueryBuilder) SearchRequestBuilder(org.elasticsearch.action.search.SearchRequestBuilder) SearchMetadataCollection(org.opencastproject.matterhorn.search.impl.SearchMetadataCollection) SearchIndexException(org.opencastproject.matterhorn.search.SearchIndexException) IOException(java.io.IOException)

Aggregations

IOException (java.io.IOException)1 SearchRequestBuilder (org.elasticsearch.action.search.SearchRequestBuilder)1 Series (org.opencastproject.index.service.impl.index.series.Series)1 SeriesQueryBuilder (org.opencastproject.index.service.impl.index.series.SeriesQueryBuilder)1 SearchIndexException (org.opencastproject.matterhorn.search.SearchIndexException)1 SearchMetadataCollection (org.opencastproject.matterhorn.search.impl.SearchMetadataCollection)1