use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class WikiCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) {
String repoEntryName = "*name not available*";
try {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
RepositoryEntry repositoryEntry = courseNode.getReferencedRepositoryEntry();
if (repositoryEntry == null)
return;
repoEntryName = repositoryEntry.getDisplayname();
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(repositoryEntry.getOlatResource());
// loop over all wiki pages
List<WikiPage> wikiPageList = wiki.getAllPagesWithContent();
for (WikiPage wikiPage : wikiPageList) {
try {
courseNodeResourceContext.setFilePath(wikiPage.getPageName());
Document document = WikiPageDocument.createDocument(courseNodeResourceContext, wikiPage);
indexWriter.addDocument(document);
} catch (Exception e) {
log.error("Error indexing wiki page:" + (wikiPage == null ? "null" : wikiPage.getPageName()), e);
}
}
} catch (Exception e) {
log.error("Error indexing wiki:" + repoEntryName, e);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class DocumentPoolIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object object, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
String taxonomyTreeKey = documentPoolModule.getTaxonomyTreeKey();
if (StringHelper.isLong(taxonomyTreeKey)) {
Long taxonomyKey = new Long(taxonomyTreeKey);
Taxonomy taxonomy = taxonomyService.getTaxonomy(new TaxonomyRefImpl(taxonomyKey));
OLATResourceable docPoolOres = OresHelper.createOLATResourceableInstanceWithoutCheck(getSupportedTypeName(), 0l);
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setBusinessControlFor(docPoolOres);
searchResourceContext.setTitle(taxonomy.getDisplayName());
searchResourceContext.setDescription(taxonomy.getDescription());
searchResourceContext.setLastModified(taxonomy.getLastModified());
searchResourceContext.setCreatedDate(taxonomy.getCreationDate());
doIndexTaxonomyLibrary(searchResourceContext, taxonomy, indexerWriter);
}
}
Aggregations