use of org.olat.modules.webFeed.search.document.FeedItemDocument in project openolat by klemens.
the class LiveBlogArtefactHandler method getContent.
@Override
protected void getContent(AbstractArtefact artefact, StringBuilder sb, SearchResourceContext context, EPFrontendManager ePFManager) {
String businessPath = artefact.getBusinessPath();
if (StringHelper.containsNonWhitespace(businessPath)) {
manager = FeedManager.getInstance();
String oresId = businessPath.substring(LIVEBLOG.length(), businessPath.length() - 1);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(BlogFileResource.TYPE_NAME, Long.parseLong(oresId));
Feed feed = manager.loadFeed(ores);
List<Item> publishedItems = manager.loadPublishedItems(feed);
for (Item item : publishedItems) {
OlatDocument itemDoc = new FeedItemDocument(item, context);
String content = itemDoc.getContent();
sb.append(content);
}
}
}
use of org.olat.modules.webFeed.search.document.FeedItemDocument in project openolat by klemens.
the class FeedCourseNodeIndexer method doIndex.
/**
* @see org.olat.search.service.indexer.Indexer#doIndex(org.olat.search.service.SearchResourceContext,
* java.lang.Object, org.olat.search.service.indexer.OlatFullIndexer)
*/
@Override
public void doIndex(SearchResourceContext courseResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexer) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(courseResourceContext, courseNode, getDocumentType());
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexer.addDocument(document);
RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry();
if (repositoryEntry != null) {
// used for log messages
String repoEntryName = "*name not available*";
try {
repoEntryName = repositoryEntry.getDisplayname();
if (log.isDebug()) {
log.info("Indexing: " + repoEntryName);
}
Feed feed = FeedManager.getInstance().loadFeed(repositoryEntry.getOlatResource());
List<Item> publishedItems = FeedManager.getInstance().loadPublishedItems(feed);
// Create the olatDocument for the feed course node itself
OlatDocument feedNodeDoc = new FeedNodeDocument(feed, courseNodeResourceContext);
indexer.addDocument(feedNodeDoc.getLuceneDocument());
// Only index items. FeedImpl itself is indexed by RepositoryEntryIndexer.
for (Item item : publishedItems) {
OlatDocument itemDoc = new FeedItemDocument(item, courseNodeResourceContext);
indexer.addDocument(itemDoc.getLuceneDocument());
}
} catch (NullPointerException e) {
log.error("Error indexing feed:" + repoEntryName, e);
}
}
}
use of org.olat.modules.webFeed.search.document.FeedItemDocument in project openolat by klemens.
the class FeedRepositoryIndexer method doIndex.
/**
* @see org.olat.search.service.indexer.Indexer#doIndex(org.olat.search.service.SearchResourceContext,
* java.lang.Object, org.olat.search.service.indexer.OlatFullIndexer)
*/
@Override
public void doIndex(SearchResourceContext searchResourceContext, Object parentObject, OlatFullIndexer indexer) throws IOException, InterruptedException {
RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
// used for log messages
String repoEntryName = "*name not available*";
try {
repoEntryName = repositoryEntry.getDisplayname();
if (isLogDebugEnabled()) {
logDebug("Indexing: " + repoEntryName);
}
Feed feed = FeedManager.getInstance().loadFeed(repositoryEntry.getOlatResource());
if (feed != null) {
// Only index items. Feed itself is indexed by RepositoryEntryIndexer.
List<Item> publishedItems = FeedManager.getInstance().loadPublishedItems(feed);
if (isLogDebugEnabled()) {
logDebug("PublishedItems size=" + publishedItems.size());
}
for (Item item : publishedItems) {
SearchResourceContext feedContext = new SearchResourceContext(searchResourceContext);
feedContext.setDocumentType(getDocumentType());
OlatDocument itemDoc = new FeedItemDocument(item, feedContext);
indexer.addDocument(itemDoc.getLuceneDocument());
}
}
} catch (NullPointerException e) {
logError("Error indexing feed:" + repoEntryName, e);
}
}
use of org.olat.modules.webFeed.search.document.FeedItemDocument in project OpenOLAT by OpenOLAT.
the class LiveBlogArtefactHandler method getContent.
@Override
protected void getContent(AbstractArtefact artefact, StringBuilder sb, SearchResourceContext context, EPFrontendManager ePFManager) {
String businessPath = artefact.getBusinessPath();
if (StringHelper.containsNonWhitespace(businessPath)) {
manager = FeedManager.getInstance();
String oresId = businessPath.substring(LIVEBLOG.length(), businessPath.length() - 1);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(BlogFileResource.TYPE_NAME, Long.parseLong(oresId));
Feed feed = manager.loadFeed(ores);
List<Item> publishedItems = manager.loadPublishedItems(feed);
for (Item item : publishedItems) {
OlatDocument itemDoc = new FeedItemDocument(item, context);
String content = itemDoc.getContent();
sb.append(content);
}
}
}
use of org.olat.modules.webFeed.search.document.FeedItemDocument in project OpenOLAT by OpenOLAT.
the class FeedRepositoryIndexer method doIndex.
/**
* @see org.olat.search.service.indexer.Indexer#doIndex(org.olat.search.service.SearchResourceContext,
* java.lang.Object, org.olat.search.service.indexer.OlatFullIndexer)
*/
@Override
public void doIndex(SearchResourceContext searchResourceContext, Object parentObject, OlatFullIndexer indexer) throws IOException, InterruptedException {
RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
// used for log messages
String repoEntryName = "*name not available*";
try {
repoEntryName = repositoryEntry.getDisplayname();
if (isLogDebugEnabled()) {
logDebug("Indexing: " + repoEntryName);
}
Feed feed = FeedManager.getInstance().loadFeed(repositoryEntry.getOlatResource());
if (feed != null) {
// Only index items. Feed itself is indexed by RepositoryEntryIndexer.
List<Item> publishedItems = FeedManager.getInstance().loadPublishedItems(feed);
if (isLogDebugEnabled()) {
logDebug("PublishedItems size=" + publishedItems.size());
}
for (Item item : publishedItems) {
SearchResourceContext feedContext = new SearchResourceContext(searchResourceContext);
feedContext.setDocumentType(getDocumentType());
OlatDocument itemDoc = new FeedItemDocument(item, feedContext);
indexer.addDocument(itemDoc.getLuceneDocument());
}
}
} catch (NullPointerException e) {
logError("Error indexing feed:" + repoEntryName, e);
}
}
Aggregations