use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class FOCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) {
try {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(document);
doIndexForum(courseNodeResourceContext, course, courseNode, indexWriter);
} catch (Exception ex) {
log.error("Exception indexing courseNode=" + courseNode, ex);
} catch (Error err) {
log.error("Error indexing courseNode=" + courseNode, err);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class ForumIndexer method doIndexAllMessages.
public void doIndexAllMessages(SearchResourceContext parentResourceContext, Forum forum, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (forum == null) {
logWarn("tried to index a forum that could not be found! skipping. context: " + parentResourceContext.getResourceUrl(), null);
return;
}
// loop over all messages of a forum
List<Message> messages = ForumManager.getInstance().getMessagesByForum(forum);
for (Message message : messages) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
searchResourceContext.setBusinessControlFor(message);
Document document = ForumMessageDocument.createDocument(searchResourceContext, message);
indexWriter.addDocument(document);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class STCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (log.isDebug())
log.debug("Index StructureNode...");
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, TYPE);
Document document = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(document);
ModuleConfiguration config = courseNode.getModuleConfiguration();
String displayType = config.getStringValue(STCourseNodeEditController.CONFIG_KEY_DISPLAY_TYPE);
String relPath = STCourseNodeEditController.getFileName(config);
if (relPath != null && displayType != null && displayType.equals(STCourseNodeEditController.CONFIG_VALUE_DISPLAY_FILE)) {
VFSItem displayPage = course.getCourseFolderContainer().resolve(relPath);
if (displayPage instanceof VFSLeaf) {
doIndexVFSLeafByMySelf(courseNodeResourceContext, (VFSLeaf) displayPage, indexWriter, relPath);
}
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class ScormCourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, NODE_TYPE);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
RepositoryEntry repoEntry = courseNode.getReferencedRepositoryEntry();
if (repoEntry != null) {
OLATResource ores = repoEntry.getOlatResource();
File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);
doIndex(courseNodeResourceContext, indexWriter, cpRoot);
}
}
use of org.olat.search.service.SearchResourceContext in project openolat by klemens.
the class TACourseNodeIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext repositoryResourceContext, ICourse course, CourseNode courseNode, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
SearchResourceContext courseNodeResourceContext = createSearchResourceContext(repositoryResourceContext, courseNode, null);
Document nodeDocument = CourseNodeDocument.createDocument(courseNodeResourceContext, courseNode);
indexWriter.addDocument(nodeDocument);
// Index Task
File fTaskfolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(course.getCourseEnvironment(), courseNode));
VFSContainer taskRootContainer = new LocalFolderImpl(fTaskfolder);
courseNodeResourceContext.setDocumentType(TYPE_TASK);
doIndexVFSContainer(courseNodeResourceContext, taskRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
// Index Dropbox
String dropboxFilePath = FolderConfig.getCanonicalRoot() + DropboxController.getDropboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
File fDropboxFolder = new File(dropboxFilePath);
VFSContainer dropboxRootContainer = new LocalFolderImpl(fDropboxFolder);
courseNodeResourceContext.setDocumentType(TYPE_DROPBOX);
doIndexVFSContainer(courseNodeResourceContext, dropboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
// Index Returnbox
String returnboxFilePath = FolderConfig.getCanonicalRoot() + ReturnboxController.getReturnboxPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
File fResturnboxFolder = new File(returnboxFilePath);
VFSContainer returnboxRootContainer = new LocalFolderImpl(fResturnboxFolder);
courseNodeResourceContext.setDocumentType(TYPE_RETURNBOX);
doIndexVFSContainer(courseNodeResourceContext, returnboxRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
// Index Solutionbox
String solutionFilePath = FolderConfig.getCanonicalRoot() + SolutionController.getSolutionPathRelToFolderRoot(course.getCourseEnvironment(), courseNode);
File fSolutionFolder = new File(solutionFilePath);
VFSContainer solutionRootContainer = new LocalFolderImpl(fSolutionFolder);
courseNodeResourceContext.setDocumentType(TYPE_SOLUTIONBOX);
doIndexVFSContainer(courseNodeResourceContext, solutionRootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
}
Aggregations