try {
repoEntryName = repositoryEntry.getDisplayname();
if (log.isDebug()) {
log.info("Indexing: " + repoEntryName);
}
Feed feed = FeedManager.getInstance().readFeed(repositoryEntry.getOlatResource());
// Set the document type, e.g. type.repository.entry.FileResource.BLOG
searchResourceContext.setDocumentType(getDocumentType());
searchResourceContext.setParentContextType(getDocumentType());
searchResourceContext.setParentContextName(repoEntryName);
// Make sure images are displayed properly
// TODO:GW It's only working for public resources, because base url is
// personal. -> fix
String mapperBaseURL = Path.getFeedBaseUri(feed, null, null, null);
Filter mediaUrlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBaseURL);
// Only index items. Feed itself is indexed by RepositoryEntryIndexer.
for (Item item : feed.getPublishedItems()) {
OlatDocument itemDoc = new FeedItemDocument(item, searchResourceContext, mediaUrlFilter);
indexer.addDocument(itemDoc.getLuceneDocument());
}
} catch (NullPointerException e) {
log.error("Error indexing feed:" + repoEntryName, e);