private static String getContent(final WikiPage wikiPage) {
    try {
      final ParserInput input = new ParserInput();
      input.setWikiUser(null);
      input.setAllowSectionEdit(false);
      input.setDepth(2);
      input.setContext("");
      input.setLocale(Locale.ENGLISH);
      input.setTopicName("dummy");
      input.setUserIpAddress("0.0.0.0");
      input.setDataHandler(DUMMY_DATA_HANDLER);
      input.setVirtualWiki("/olat");

      final AbstractParser parser = new JFlexParser(input);
      final ParserDocument parsedDoc = parser.parseHTML(wikiPage.getContent());
      final String parsedContent = parsedDoc.getContent();
      final String filteredContent =
          FilterFactory.getHtmlTagAndDescapingFilter().filter(parsedContent);
      return filteredContent;
    } catch (final Exception e) {
      e.printStackTrace();
      log.error("", e);
      return wikiPage.getContent();
    }
  }
  public static Document createDocument(
      final SearchResourceContext searchResourceContext, final WikiPage wikiPage) {
    final WikiPageDocument wikiPageDocument = new WikiPageDocument();

    final long userId = wikiPage.getInitalAuthor();
    if (userId != 0) {
      final Identity identity = identityManager.loadIdentityByKey(Long.valueOf(userId));
      wikiPageDocument.setAuthor(identity.getName());
    }
    wikiPageDocument.setTitle(wikiPage.getPageName());
    wikiPageDocument.setContent(getContent(wikiPage));
    wikiPageDocument.setCreatedDate(new Date(wikiPage.getCreationTime()));
    wikiPageDocument.setLastChange(new Date(wikiPage.getModificationTime()));
    wikiPageDocument.setResourceUrl(searchResourceContext.getResourceUrl());
    wikiPageDocument.setDocumentType(searchResourceContext.getDocumentType());
    wikiPageDocument.setCssIcon("o_wiki_icon");
    wikiPageDocument.setParentContextType(searchResourceContext.getParentContextType());
    wikiPageDocument.setParentContextName(searchResourceContext.getParentContextName());

    if (log.isDebug()) {
      log.debug(wikiPageDocument.toString());
    }
    return wikiPageDocument.getLuceneDocument();
  }