Example usage for com.liferay.portal.kernel.search Field ASSET_VOCABULARY_IDS

List of usage examples for com.liferay.portal.kernel.search Field ASSET_VOCABULARY_IDS

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.search Field ASSET_VOCABULARY_IDS.

Prototype

String ASSET_VOCABULARY_IDS

To view the source code for com.liferay.portal.kernel.search Field ASSET_VOCABULARY_IDS.

Click Source Link

Usage

From source file:com.liferay.asset.categories.internal.search.AssetCategoryIndexer.java

License:Open Source License

@Override
public void postProcessContextBooleanFilter(BooleanFilter contextBooleanFilter, SearchContext searchContext)
        throws Exception {

    long[] parentCategoryIds = (long[]) searchContext.getAttribute(Field.ASSET_PARENT_CATEGORY_IDS);

    if (!ArrayUtil.isEmpty(parentCategoryIds)) {
        TermsFilter parentCategoryTermsFilter = new TermsFilter(Field.ASSET_PARENT_CATEGORY_ID);

        parentCategoryTermsFilter.addValues(ArrayUtil.toStringArray(parentCategoryIds));

        contextBooleanFilter.add(parentCategoryTermsFilter, BooleanClauseOccur.MUST);
    }//from   w  ww  . ja  v  a  2 s . com

    long[] vocabularyIds = (long[]) searchContext.getAttribute(Field.ASSET_VOCABULARY_IDS);

    if (!ArrayUtil.isEmpty(vocabularyIds)) {
        TermsFilter vocabularyTermsFilter = new TermsFilter(Field.ASSET_VOCABULARY_ID);

        vocabularyTermsFilter.addValues(ArrayUtil.toStringArray(vocabularyIds));

        contextBooleanFilter.add(vocabularyTermsFilter, BooleanClauseOccur.MUST);
    }
}