Examples of OlatDocument


Examples of org.olat.core.commons.services.search.OlatDocument

    // strip all html tags
    Filter htmlTagsFilter = FilterFactory.getHtmlTagsFilter();
    glossaryContent = htmlTagsFilter.filter(glossaryContent);
   
    // create standard olat index document with this data
    OlatDocument glossaryDocument = new OlatDocument();
    if (repositoryEntry.getInitialAuthor() != null) {
      glossaryDocument.setAuthor(repositoryEntry.getInitialAuthor());
    }
    if (repositoryEntry.getDisplayname() != null) {
      glossaryDocument.setTitle(repositoryEntry.getDisplayname());
    }
    if (repositoryEntry.getDescription() != null) {
      glossaryDocument.setDescription(htmlTagsFilter.filter(repositoryEntry.getDescription()));
    }
    glossaryDocument.setContent(glossaryContent);
    glossaryDocument.setCreatedDate(repositoryEntry.getCreationDate());
    glossaryDocument.setLastChange(new Date(glossaryFile.getLastModified()));
    glossaryDocument.setResourceUrl(searchResourceContext.getResourceUrl());
    glossaryDocument.setDocumentType(searchResourceContext.getDocumentType());
    glossaryDocument.setCssIcon("o_FileResource-GLOSSARY_icon");
    return glossaryDocument.getLuceneDocument()
  }
View Full Code Here

Examples of org.olat.core.commons.services.search.OlatDocument

      SearchResourceContext nodeSearchContext = new SearchResourceContext(searchResourceContext);
      nodeSearchContext.setBusinessControlFor(node);
      nodeSearchContext.setDocumentType(getDocumentType());

      // Create the olatDocument for the feed course node itself
      OlatDocument feedNodeDoc = new FeedNodeDocument(feed, nodeSearchContext);
      indexer.addDocument(feedNodeDoc.getLuceneDocument());
     
      // Make sure images are displayed properly
      String mapperBaseURL = Path.getFeedBaseUri(feed, null, course.getResourceableId(), node.getIdent());
      Filter mediaUrlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBaseURL);

      // Only index items. Feed itself is indexed by RepositoryEntryIndexer.
      for (Item item : feed.getPublishedItems()) {
        OlatDocument itemDoc = new FeedItemDocument(item, nodeSearchContext, mediaUrlFilter);
        indexer.addDocument(itemDoc.getLuceneDocument());
      }
    } catch (NullPointerException e) {
      log.error("Error indexing feed:" + repoEntryName, e);
    }
View Full Code Here

Examples of org.olat.core.commons.services.search.OlatDocument

      String mapperBaseURL = Path.getFeedBaseUri(feed, null, null, null);
      Filter mediaUrlFilter = FilterFactory.getBaseURLToMediaRelativeURLFilter(mapperBaseURL);

      // Only index items. Feed itself is indexed by RepositoryEntryIndexer.
      for (Item item : feed.getPublishedItems()) {
        OlatDocument itemDoc = new FeedItemDocument(item, searchResourceContext, mediaUrlFilter);
        indexer.addDocument(itemDoc.getLuceneDocument());
      }
    } catch (NullPointerException e) {
      log.error("Error indexing feed:" + repoEntryName, e);
    }
View Full Code Here

Examples of org.olat.core.commons.services.search.OlatDocument

   */
  private List<ResultDocument> convertToResultDocument(Query query, Analyzer analyzer, boolean doHighlighting, List<OlatDocument> filteredList) throws IOException {
    List<ResultDocument> newResultList = new ArrayList<ResultDocument>(maxResults);
    Iterator<OlatDocument> iter = filteredList.iterator();
    while (iter.hasNext()) {
      OlatDocument odoc = iter.next();
      Document doc = odoc.getLuceneDocument();
      ResultDocument resultDocument = new ResultDocument(doc);
      if (doHighlighting) {
        doHighlight(query, analyzer, doc, resultDocument);
      }
      newResultList.add(resultDocument);
View Full Code Here

Examples of org.olat.core.commons.services.search.OlatDocument

    // build up a list
    int numOfDocs = Math.min(maxHits, docs.totalHits);
    List<OlatDocument> res = new ArrayList<OlatDocument>(numOfDocs);
    for (int i=0; i<numOfDocs; i++) {
      Document luDoc = searcher.doc(docs.scoreDocs[i].doc);
      res.add(new OlatDocument(luDoc));
    }
    return res;
  }
View Full Code Here

Examples of org.olat.core.commons.services.search.OlatDocument

    while (it_odocs.hasNext() && resultCount < maxToReturn) {
      long elementStartTime = 0;
      if ( log.isDebug() ) {
        elementStartTime = System.currentTimeMillis();
      }
      OlatDocument odoc = it_odocs.next();
      String resourceUrl = odoc.getResourceUrl();
      BusinessControl businessControl = BusinessControlFactory.getInstance().createFromString(resourceUrl);
      boolean hasAccess = mainIndexer.checkAccess(null, businessControl, identity, roles);
      if (hasAccess) {
        filteredList.add(odoc);
        resultCount++;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.