protected I_CmsSearchDocument createIndexDocument(
        CmsObject cms,
        CmsResource res,
        I_CmsSearchIndex index,
        int count,
        I_CmsReport report)
    throws CmsException {

        I_CmsSearchDocument result = null;

        if (report != null) {
            report.print(
                org.opencms.report.Messages.get().container(
                    org.opencms.report.Messages.RPT_SUCCESSION_1,
                    String.valueOf(count)),
                I_CmsReport.FORMAT_NOTE);
            report.print(Messages.get().container(Messages.RPT_SEARCH_INDEXING_FILE_BEGIN_0), I_CmsReport.FORMAT_NOTE);
            report.print(
                org.opencms.report.Messages.get().container(
                    org.opencms.report.Messages.RPT_ARGUMENT_1,
                    report.removeSiteRoot(res.getRootPath())));
            report.print(
                org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_DOTS_0),
                I_CmsReport.FORMAT_DEFAULT);
        }

        if (m_index.excludeFromIndex(m_cms, m_res)) {
            m_addDefaultDocument = false;
        } else {
            // resource is to be included in the index
            I_CmsDocumentFactory documentFactory = index.getDocumentFactory(res);
            if (documentFactory != null) {
                // some resources e.g. JSP do not have a default document factory
                if (LOG.isDebugEnabled()) {
                    LOG.debug(
                        Messages.get().getBundle().key(
                            Messages.LOG_INDEXING_WITH_FACTORY_2,
                            res.getRootPath(),
                            documentFactory.getName()));
                }
                // create the document
                result = documentFactory.createDocument(cms, res, index);
            } else {
                m_addDefaultDocument = false;
            }
        }
        if (result == null) {
            // this resource is not contained in the given search index or locale did not match
            if (report != null) {
                report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_SKIPPED_0),
                    I_CmsReport.FORMAT_NOTE);
            }
            if (LOG.isDebugEnabled()) {
                LOG.debug(Messages.get().getBundle().key(Messages.LOG_SKIPPED_1, res.getRootPath()));
            }
        } else {
            // index document was successfully created
            if ((m_report != null)) {
                m_report.println(
                    org.opencms.report.Messages.get().container(org.opencms.report.Messages.RPT_OK_0),
                    I_CmsReport.FORMAT_OK);
            }
        }

        return result;
    }
protected I_CmsSearchDocument createIndexDocument ( CmsObject cms , CmsResource res , I_CmsSearchIndex index , int count , I_CmsReport report ) throws CmsException { I_CmsSearchDocument result = null ; if ( report != null ) { report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SUCCESSION_1 , String . valueOf ( count ) ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( Messages . get ( ) . container ( Messages . RPT_SEARCH_INDEXING_FILE_BEGIN_0 ) , I_CmsReport . FORMAT_NOTE ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , report . removeSiteRoot ( res . getRootPath ( ) ) ) ) ; report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_DOTS_0 ) , I_CmsReport . FORMAT_DEFAULT ) ; } if ( m_index . excludeFromIndex ( m_cms , m_res ) ) { m_addDefaultDocument = false ; } else { I_CmsDocumentFactory documentFactory = index . getDocumentFactory ( res ) ; if ( documentFactory != null ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_INDEXING_WITH_FACTORY_2 , res . getRootPath ( ) , documentFactory . getName ( ) ) ) ; } result = documentFactory . createDocument ( cms , res , index ) ; } else { m_addDefaultDocument = false ; } } if ( result == null ) { if ( report != null ) { report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_SKIPPED_0 ) , I_CmsReport . FORMAT_NOTE ) ; } if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SKIPPED_1 , res . getRootPath ( ) ) ) ; } } else { if ( ( m_report != null ) ) { m_report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } } return result ; }
Creates the search index document.<p>

@param cms the current OpenCms user context
@param res the resource to index
@param index the index to update the resource in
@param count the report count
@param report the report to write the output to

@return the created search index document

@throws CmsException in case of issues while creating the search index document