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

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

Introduction

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

Prototype

String ASSET_CATEGORY_ID

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

Click Source Link

Usage

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

License:Open Source License

public AssetCategoryIndexer() {
    setDefaultSelectedFieldNames(Field.ASSET_CATEGORY_ID, Field.COMPANY_ID, Field.GROUP_ID, Field.UID);
    setFilterSearch(true);
    setPermissionAware(true);
}

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

License:Open Source License

@Override
protected Document doGetDocument(AssetCategory assetCategory) throws Exception {

    if (_log.isDebugEnabled()) {
        _log.debug("Indexing asset category " + assetCategory);
    }//from   w ww .j  av  a 2  s.c o  m

    Document document = getBaseModelDocument(CLASS_NAME, assetCategory);

    document.addKeyword(Field.ASSET_CATEGORY_ID, assetCategory.getCategoryId());

    List<AssetCategory> categories = new ArrayList<>(1);

    categories.add(assetCategory);

    addSearchAssetCategoryTitles(document, Field.ASSET_CATEGORY_TITLE, categories);

    document.addKeyword(Field.ASSET_PARENT_CATEGORY_ID, assetCategory.getParentCategoryId());
    document.addKeyword(Field.ASSET_VOCABULARY_ID, assetCategory.getVocabularyId());

    Locale siteDefaultLocale = _portal.getSiteDefaultLocale(assetCategory.getGroupId());

    addLocalizedField(document, Field.DESCRIPTION, siteDefaultLocale, assetCategory.getDescriptionMap());

    document.addText(Field.NAME, assetCategory.getName());
    addLocalizedField(document, Field.TITLE, siteDefaultLocale, assetCategory.getTitleMap());
    document.addKeyword("leftCategoryId", assetCategory.getLeftCategoryId());

    if (_log.isDebugEnabled()) {
        _log.debug("Document " + assetCategory + " indexed successfully");
    }

    return document;
}