use of org.opencastproject.matterhorn.search.impl.ElasticsearchDocument in project opencast by opencast.
the class AbstractSearchIndex method addOrUpdate.
/**
* Add or update a series in the search index.
*
* @param series
* @throws SearchIndexException
*/
public void addOrUpdate(Series series) throws SearchIndexException {
logger.debug("Adding resource {} to search index", series);
// if (!preparedIndices.contains(resource.getURI().getSite().getIdentifier())) {
// try {
// createIndex(resource.getURI().getSite());
// } catch (IOException e) {
// throw new SearchIndexException(e);
// }
// }
// Add the resource to the index
SearchMetadataCollection inputDocument = SeriesIndexUtils.toSearchMetadata(series);
List<SearchMetadata<?>> resourceMetadata = inputDocument.getMetadata();
ElasticsearchDocument doc = new ElasticsearchDocument(inputDocument.getIdentifier(), inputDocument.getDocumentType(), resourceMetadata);
try {
update(doc);
} catch (Throwable t) {
throw new SearchIndexException("Cannot write resource " + series + " to index", t);
}
}
use of org.opencastproject.matterhorn.search.impl.ElasticsearchDocument in project opencast by opencast.
the class AbstractSearchIndex method addOrUpdate.
/**
* Adds or updates the theme in the search index.
*
* @param theme
* The theme to add
* @throws SearchIndexException
* Thrown if unable to add or update the theme.
*/
public void addOrUpdate(Theme theme) throws SearchIndexException {
logger.debug("Adding resource {} to search index", theme);
// if (!preparedIndices.contains(resource.getURI().getSite().getIdentifier())) {
// try {
// createIndex(resource.getURI().getSite());
// } catch (IOException e) {
// throw new SearchIndexException(e);
// }
// }
// Add the resource to the index
SearchMetadataCollection inputDocument = ThemeIndexUtils.toSearchMetadata(theme);
List<SearchMetadata<?>> resourceMetadata = inputDocument.getMetadata();
ElasticsearchDocument doc = new ElasticsearchDocument(inputDocument.getIdentifier(), inputDocument.getDocumentType(), resourceMetadata);
try {
update(doc);
} catch (Throwable t) {
throw new SearchIndexException("Cannot write resource " + theme + " to index", t);
}
}
use of org.opencastproject.matterhorn.search.impl.ElasticsearchDocument in project opencast by opencast.
the class AbstractSearchIndex method addOrUpdate.
/**
* Adds the recording event to the search index or updates it accordingly if it is there.
*
* @param event
* the recording event
* @throws SearchIndexException
* if the event cannot be added or updated
*/
public void addOrUpdate(Event event) throws SearchIndexException {
logger.debug("Adding resource {} to search index", event);
// if (!preparedIndices.contains(resource.getURI().getSite().getIdentifier())) {
// try {
// createIndex(resource.getURI().getSite());
// } catch (IOException e) {
// throw new SearchIndexException(e);
// }
// }
// Add the resource to the index
SearchMetadataCollection inputDocument = EventIndexUtils.toSearchMetadata(event);
List<SearchMetadata<?>> resourceMetadata = inputDocument.getMetadata();
ElasticsearchDocument doc = new ElasticsearchDocument(inputDocument.getIdentifier(), inputDocument.getDocumentType(), resourceMetadata);
try {
update(doc);
} catch (Throwable t) {
throw new SearchIndexException("Cannot write resource " + event + " to index", t);
}
}
use of org.opencastproject.matterhorn.search.impl.ElasticsearchDocument in project opencast by opencast.
the class AbstractSearchIndex method addOrUpdate.
/**
* Adds or updates the group in the search index.
*
* @param group
* The group to add
* @throws SearchIndexException
* Thrown if unable to add or update the group.
*/
public void addOrUpdate(Group group) throws SearchIndexException {
logger.debug("Adding resource {} to search index", group);
// if (!preparedIndices.contains(resource.getURI().getSite().getIdentifier())) {
// try {
// createIndex(resource.getURI().getSite());
// } catch (IOException e) {
// throw new SearchIndexException(e);
// }
// }
// Add the resource to the index
SearchMetadataCollection inputDocument = GroupIndexUtils.toSearchMetadata(group);
List<SearchMetadata<?>> resourceMetadata = inputDocument.getMetadata();
ElasticsearchDocument doc = new ElasticsearchDocument(inputDocument.getIdentifier(), inputDocument.getDocumentType(), resourceMetadata);
try {
update(doc);
} catch (Throwable t) {
throw new SearchIndexException("Cannot write resource " + group + " to index", t);
}
}
Aggregations