Skip to content
Snippets Groups Projects
Commit 3a216c29 authored by srosse's avatar srosse
Browse files

OO-2626: index blog, podcast course element, add indexer of contact to the indexer hierarchy

parent b3a31e3e
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,7 @@ public class BlogCourseNodeIndexer extends FeedCourseNodeIndexer { ...@@ -35,6 +35,7 @@ public class BlogCourseNodeIndexer extends FeedCourseNodeIndexer {
/** /**
* @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getSupportedTypeName() * @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getSupportedTypeName()
*/ */
@Override
public String getSupportedTypeName() { public String getSupportedTypeName() {
return SUPPORTED_TYPE_NAME; return SUPPORTED_TYPE_NAME;
} }
...@@ -42,6 +43,7 @@ public class BlogCourseNodeIndexer extends FeedCourseNodeIndexer { ...@@ -42,6 +43,7 @@ public class BlogCourseNodeIndexer extends FeedCourseNodeIndexer {
/** /**
* @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getDocumentType() * @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getDocumentType()
*/ */
@Override
protected String getDocumentType() { protected String getDocumentType() {
return TYPE; return TYPE;
} }
......
...@@ -21,6 +21,7 @@ package org.olat.modules.webFeed.search.indexer; ...@@ -21,6 +21,7 @@ package org.olat.modules.webFeed.search.indexer;
import java.io.IOException; import java.io.IOException;
import org.apache.lucene.document.Document;
import org.olat.core.logging.OLog; import org.olat.core.logging.OLog;
import org.olat.core.logging.Tracing; import org.olat.core.logging.Tracing;
import org.olat.course.ICourse; import org.olat.course.ICourse;
...@@ -33,6 +34,7 @@ import org.olat.modules.webFeed.search.document.FeedNodeDocument; ...@@ -33,6 +34,7 @@ import org.olat.modules.webFeed.search.document.FeedNodeDocument;
import org.olat.repository.RepositoryEntry; import org.olat.repository.RepositoryEntry;
import org.olat.search.model.OlatDocument; import org.olat.search.model.OlatDocument;
import org.olat.search.service.SearchResourceContext; import org.olat.search.service.SearchResourceContext;
import org.olat.search.service.document.CourseNodeDocument;
import org.olat.search.service.indexer.DefaultIndexer; import org.olat.search.service.indexer.DefaultIndexer;
import org.olat.search.service.indexer.OlatFullIndexer; import org.olat.search.service.indexer.OlatFullIndexer;
import org.olat.search.service.indexer.repository.course.CourseNodeIndexer; import org.olat.search.service.indexer.repository.course.CourseNodeIndexer;
...@@ -60,8 +62,13 @@ public abstract class FeedCourseNodeIndexer extends DefaultIndexer implements Co ...@@ -60,8 +62,13 @@ public abstract class FeedCourseNodeIndexer extends DefaultIndexer implements Co
* java.lang.Object, org.olat.search.service.indexer.OlatFullIndexer) * java.lang.Object, org.olat.search.service.indexer.OlatFullIndexer)
*/ */
@Override @Override
public void doIndex(SearchResourceContext searchResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexer) public void doIndex(SearchResourceContext courseResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexer)
throws IOException, InterruptedException { throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(courseResourceContext, courseNode, getDocumentType());
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexer.addDocument(document);
RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry(); RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry();
if(repositoryEntry != null) { if(repositoryEntry != null) {
// used for log messages // used for log messages
...@@ -72,21 +79,14 @@ public abstract class FeedCourseNodeIndexer extends DefaultIndexer implements Co ...@@ -72,21 +79,14 @@ public abstract class FeedCourseNodeIndexer extends DefaultIndexer implements Co
log.info("Indexing: " + repoEntryName); log.info("Indexing: " + repoEntryName);
} }
Feed feed = FeedManager.getInstance().getFeed(repositoryEntry.getOlatResource()); Feed feed = FeedManager.getInstance().getFeed(repositoryEntry.getOlatResource());
// Set the document type, e.g. type.repository.entry.FileResource.BLOG
SearchResourceContext nodeSearchContext = new SearchResourceContext(searchResourceContext);
nodeSearchContext.setBusinessControlFor(courseNode);
nodeSearchContext.setDocumentType(getDocumentType());
nodeSearchContext.setTitle(courseNode.getShortTitle());
nodeSearchContext.setDescription(courseNode.getLongTitle());
// Create the olatDocument for the feed course node itself // Create the olatDocument for the feed course node itself
OlatDocument feedNodeDoc = new FeedNodeDocument(feed, nodeSearchContext); OlatDocument feedNodeDoc = new FeedNodeDocument(feed, courseNodeResourceContext);
indexer.addDocument(feedNodeDoc.getLuceneDocument()); indexer.addDocument(feedNodeDoc.getLuceneDocument());
// Only index items. Feed itself is indexed by RepositoryEntryIndexer. // Only index items. Feed itself is indexed by RepositoryEntryIndexer.
for (Item item : feed.getPublishedItems()) { for (Item item : feed.getPublishedItems()) {
OlatDocument itemDoc = new FeedItemDocument(item, nodeSearchContext); OlatDocument itemDoc = new FeedItemDocument(item, courseNodeResourceContext);
indexer.addDocument(itemDoc.getLuceneDocument()); indexer.addDocument(itemDoc.getLuceneDocument());
} }
} catch (NullPointerException e) { } catch (NullPointerException e) {
......
...@@ -36,6 +36,7 @@ public class PodcastCourseNodeIndexer extends FeedCourseNodeIndexer { ...@@ -36,6 +36,7 @@ public class PodcastCourseNodeIndexer extends FeedCourseNodeIndexer {
/** /**
* @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getSupportedTypeName() * @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getSupportedTypeName()
*/ */
@Override
public String getSupportedTypeName() { public String getSupportedTypeName() {
return SUPPORTED_TYPE_NAME; return SUPPORTED_TYPE_NAME;
} }
...@@ -43,6 +44,7 @@ public class PodcastCourseNodeIndexer extends FeedCourseNodeIndexer { ...@@ -43,6 +44,7 @@ public class PodcastCourseNodeIndexer extends FeedCourseNodeIndexer {
/** /**
* @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getDocumentType() * @see org.olat.modules.webFeed.search.indexer.FeedRepositoryIndexer#getDocumentType()
*/ */
@Override
protected String getDocumentType() { protected String getDocumentType() {
return TYPE; return TYPE;
} }
......
...@@ -204,10 +204,12 @@ ...@@ -204,10 +204,12 @@
<ref bean="vcCourseNodeIndexer" /> <ref bean="vcCourseNodeIndexer" />
<ref bean="videoCourseNodeIndexer" /> <ref bean="videoCourseNodeIndexer" />
<ref bean="viteroCourseNodeIndexer" /> <ref bean="viteroCourseNodeIndexer" />
<ref bean="coCourseNodeIndexer" />
</list> </list>
</property> </property>
</bean> </bean>
<bean id="coCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.COCourseNodeIndexer" />
<bean id="tuCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.TUCourseNodeIndexer" /> <bean id="tuCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.TUCourseNodeIndexer" />
<bean id="vcCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.VCCourseNodeIndexer" /> <bean id="vcCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.VCCourseNodeIndexer" />
<bean id="videoCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.VideoCourseNodeIndexer" /> <bean id="videoCourseNodeIndexer" class="org.olat.search.service.indexer.repository.course.VideoCourseNodeIndexer" />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment