code: @Override
      public I_CmsDocumentFactory getDocumentFactory(CmsResource res) {
  
          if ((res != null) && (getSources() != null)) {
              // the result can only be null or the type configured for the resource
              I_CmsDocumentFactory result = OpenCms.getSearchManager().getDocumentFactory(res);
              if (result != null) {
                  // check the path of the resource if it matches with one (or more) of the configured index sources
                  for (CmsSearchIndexSource source : getSources()) {
                      if (source.isIndexing(res.getRootPath(), result.getName())
                          || (source.isIndexing(res.getRootPath(), TYPE_XMLCONTENT)
                              && CmsResourceTypeXmlContent.isXmlContent(res))) {
                          // we found an index source that indexes the resource
                          return result;
                      }
                  }
              }
          }
          return null;
      }
docs: Returns the document type factory used for the given resource in this index, or <code>null</code>
  in case the resource is not indexed by this index.<p>
  
  A resource is indexed if the following is all true: <ol>
  <li>The index contains at last one index source matching the root path of the given resource.
  <li>For this matching index source, the document type factory needed by the resource is also configured.
  </ol>
  
  @param res the resource to check
  
  @return he document type factory used for the given resource in this index, or <code>null</code>
  in case the resource is not indexed by this index