public boolean excludeFromIndex(CmsObject cms, CmsResource resource) {

        // check if this resource should be excluded from the index, if so skip it
        boolean excludeFromIndex = false;

        if (resource.isInternal()
            || resource.isFolder()
            || resource.isTemporaryFile()
            || (resource.getDateExpired() <= System.currentTimeMillis())) {
            // don't index internal resources, folders or temporary files or resources with expire date in the past
            return true;
        }

        try {
            // do property lookup with folder search
            String propValue = cms.readPropertyObject(
                resource,
                CmsPropertyDefinition.PROPERTY_SEARCH_EXCLUDE,
                true).getValue();
            excludeFromIndex = Boolean.valueOf(propValue).booleanValue();
            if (!excludeFromIndex && (propValue != null)) {
                // property value was neither "true" nor null, must check for "all"
                excludeFromIndex = PROPERTY_SEARCH_EXCLUDE_VALUE_ALL.equalsIgnoreCase(propValue.trim());
            }
        } catch (CmsException e) {
            if (LOG.isDebugEnabled()) {
                LOG.debug(
                    Messages.get().getBundle().key(Messages.LOG_UNABLE_TO_READ_PROPERTY_1, resource.getRootPath()));
            }
        }
        if (!excludeFromIndex && !USE_ALL_LOCALE.equalsIgnoreCase(getLocale().getLanguage())) {
            // check if any resource default locale has a match with the index locale, if not skip resource
            List<Locale> locales = OpenCms.getLocaleManager().getDefaultLocales(cms, resource);
            Locale match = OpenCms.getLocaleManager().getFirstMatchingLocale(
                Collections.singletonList(getLocale()),
                locales);
            excludeFromIndex = (match == null);
        }

        return excludeFromIndex;
    }
public boolean excludeFromIndex ( CmsObject cms , CmsResource resource ) { boolean excludeFromIndex = false ; if ( resource . isInternal ( ) || resource . isFolder ( ) || resource . isTemporaryFile ( ) || ( resource . getDateExpired ( ) <= System . currentTimeMillis ( ) ) ) { return true ; } try { String propValue = cms . readPropertyObject ( resource , CmsPropertyDefinition . PROPERTY_SEARCH_EXCLUDE , true ) . getValue ( ) ; excludeFromIndex = Boolean . valueOf ( propValue ) . booleanValue ( ) ; if ( ! excludeFromIndex && ( propValue != null ) ) { excludeFromIndex = PROPERTY_SEARCH_EXCLUDE_VALUE_ALL . equalsIgnoreCase ( propValue . trim ( ) ) ; } } catch ( CmsException e ) { if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_UNABLE_TO_READ_PROPERTY_1 , resource . getRootPath ( ) ) ) ; } } if ( ! excludeFromIndex && ! USE_ALL_LOCALE . equalsIgnoreCase ( getLocale ( ) . getLanguage ( ) ) ) { List < Locale > locales = OpenCms . getLocaleManager ( ) . getDefaultLocales ( cms , resource ) ; Locale match = OpenCms . getLocaleManager ( ) . getFirstMatchingLocale ( Collections . singletonList ( getLocale ( ) ) , locales ) ; excludeFromIndex = ( match == null ) ; } return excludeFromIndex ; }
Checks if the provided resource should be excluded from this search index.<p>

@param cms the OpenCms context used for building the search index
@param resource the resource to index

@return true if the resource should be excluded, false if it should be included in this index