code: protected I_CmsSearchDocument appendCategories(
          I_CmsSearchDocument document,
          CmsObject cms,
          CmsResource resource,
          I_CmsExtractionResult extractionResult,
          List<CmsProperty> properties,
          List<CmsProperty> propertiesSearched)
      throws CmsException {
  
          CmsCategoryService categoryService = CmsCategoryService.getInstance();
          document.addCategoryField(categoryService.readResourceCategories(cms, resource));
  
          return document;
      }
docs: Extends the given document by resource category information based on properties.<p>
  
  @param document the document to extend
  @param cms the OpenCms context used for building the search index
  @param resource the resource that is indexed
  @param extractionResult the plain text extraction result from the resource
  @param properties the list of all properties directly attached to the resource (not searched)
  @param propertiesSearched the list of all searched properties of the resource
  
  @return the document extended by resource category information
  
  @throws CmsException if something goes wrong