code: protected CmsResource getResource(CmsObject cms, I_CmsSearchDocument doc) {
  
          // check if the resource exits in the VFS,
          // this will implicitly check read permission and if the resource was deleted
          CmsResourceFilter filter = CmsResourceFilter.DEFAULT;
          if (isRequireViewPermission()) {
              filter = CmsResourceFilter.DEFAULT_ONLY_VISIBLE;
          } else if (isIgnoreExpiration()) {
              filter = CmsResourceFilter.IGNORE_EXPIRATION;
          }
  
          return getResource(cms, doc, filter);
      }
docs: Checks if the OpenCms resource referenced by the result document can be read
  by the user of the given OpenCms context.
  
  Returns the referenced <code>CmsResource</code> or <code>null</code> if
  the user is not permitted to read the resource.<p>
  
  @param cms the OpenCms user context to use for permission testing
  @param doc the search result document to check
  
  @return the referenced <code>CmsResource</code> or <code>null</code> if the user is not permitted