use of org.olat.search.service.SearchResourceContext in project OpenOLAT by OpenOLAT.
the class QuestionItemIndexer method indexDocument.
@Override
public void indexDocument(List<Long> keyList, LifeFullIndexer indexWriter) {
QuestionItemDocumentFactory docFactory = CoreSpringFactory.getImpl(QuestionItemDocumentFactory.class);
List<Document> docs = new ArrayList<>(keyList.size());
for (Long key : keyList) {
SearchResourceContext ctxt = new SearchResourceContext();
Document doc = docFactory.createDocument(ctxt, key);
docs.add(doc);
}
indexWriter.addDocuments(docs);
}
use of org.olat.search.service.SearchResourceContext in project OpenOLAT by OpenOLAT.
the class GroupFolderIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
String path = collaborationManager.getFolderRelPath(businessGroup);
OlatRootFolderImpl rootContainer = new OlatRootFolderImpl(path, null);
SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFOLDER);
forumSearchResourceContext.setDocumentType(TYPE);
forumSearchResourceContext.setParentContextType(GroupDocument.TYPE);
forumSearchResourceContext.setParentContextName(businessGroup.getName());
doIndexVFSContainer(forumSearchResourceContext, rootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
}
use of org.olat.search.service.SearchResourceContext in project OpenOLAT by OpenOLAT.
the class GroupForumIndexer method doIndex.
/**
* Index a forum in a group.
* @param parentResourceContext
* @param businessGroup
* @param indexWriter
* @throws IOException
*/
@Override
public void doIndex(SearchResourceContext parentResourceContext, Object businessObj, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
if (!(businessObj instanceof BusinessGroup))
throw new AssertException("businessObj must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObj;
NarrowedPropertyManager npm = NarrowedPropertyManager.getInstance(businessGroup);
ForumManager fom = ForumManager.getInstance();
Property forumKeyProperty = npm.findProperty(null, null, CollaborationTools.PROP_CAT_BG_COLLABTOOLS, CollaborationTools.KEY_FORUM);
// Check if forum-property exist
if (forumKeyProperty != null) {
Long forumKey = forumKeyProperty.getLongValue();
Forum forum = fom.loadForum(forumKey);
SearchResourceContext forumSearchResourceContext = new SearchResourceContext(parentResourceContext);
forumSearchResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLFORUM);
forumSearchResourceContext.setDocumentType(TYPE);
forumSearchResourceContext.setParentContextType(GroupDocument.TYPE);
forumSearchResourceContext.setParentContextName(businessGroup.getName());
if (forum == null) {
// fxdiff: FXOLAT-104 warn about missing forums
logError("found a forum-key " + forumKey + " for businessgroup " + businessGroup.getName() + " [" + businessGroup.getKey() + "] to index a forum that could not be " + "found by key! skip indexing, check if forum should still be enabled. context: " + forumSearchResourceContext.getResourceUrl(), null);
return;
}
doIndexAllMessages(forumSearchResourceContext, forum, indexWriter);
}
}
use of org.olat.search.service.SearchResourceContext in project OpenOLAT by OpenOLAT.
the class GroupInfoIndexer method doIndex.
@Override
public void doIndex(SearchResourceContext searchResourceContext, Object businessObject, OlatFullIndexer indexerWriter) throws IOException, InterruptedException {
if (!(businessObject instanceof BusinessGroup))
throw new AssertException("businessObject must be BusinessGroup");
BusinessGroup businessGroup = (BusinessGroup) businessObject;
try {
SearchResourceContext messagesGroupResourceContext = new SearchResourceContext(searchResourceContext);
messagesGroupResourceContext.setBusinessControlFor(BusinessGroupMainRunController.ORES_TOOLMSG);
messagesGroupResourceContext.setDocumentType(TYPE);
doIndexInfos(messagesGroupResourceContext, businessGroup, indexerWriter);
} catch (Exception ex) {
log.error("Exception indexing businessGroup=" + businessGroup, ex);
} catch (Error err) {
log.error("Error indexing businessGroup=" + businessGroup, err);
}
}
use of org.olat.search.service.SearchResourceContext in project OpenOLAT by OpenOLAT.
the class GroupInfoIndexer method doIndexInfos.
private void doIndexInfos(SearchResourceContext parentResourceContext, BusinessGroup businessGroup, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
List<InfoMessage> messages = infoMessageManager.loadInfoMessageByResource(businessGroup, InfoMessageFrontendManager.businessGroupResSubPath, null, null, null, 0, -1);
for (InfoMessage message : messages) {
SearchResourceContext searchResourceContext = new SearchResourceContext(parentResourceContext);
OLATResourceable ores = OresHelper.createOLATResourceableInstance(InfoMessage.class, message.getKey());
searchResourceContext.setBusinessControlFor(ores);
Document document = InfoMessageDocument.createDocument(searchResourceContext, message);
indexWriter.addDocument(document);
}
}
Aggregations