Example usage for com.liferay.portal.kernel.search SearchContextFactory getInstance

List of usage examples for com.liferay.portal.kernel.search SearchContextFactory getInstance

Introduction

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

Prototype

public static SearchContext getInstance(long[] assetCategoryIds, String[] assetTagNames,
            Map<String, Serializable> attributes, long companyId, String keywords, Layout layout, Locale locale,
            long scopeGroupId, TimeZone timeZone, long userId) 

Source Link

Usage

From source file:com.liferay.asset.internal.util.AssetHelperImpl.java

License:Open Source License

@Override
public BaseModelSearchResult<AssetEntry> searchAssetEntries(AssetEntryQuery assetEntryQuery,
        long[] assetCategoryIds, String[] assetTagNames, Map<String, Serializable> attributes, long companyId,
        String keywords, Layout layout, Locale locale, long scopeGroupId, TimeZone timeZone, long userId,
        int start, int end) throws Exception {

    SearchContext searchContext = SearchContextFactory.getInstance(assetCategoryIds, assetTagNames, attributes,
            companyId, keywords, layout, locale, scopeGroupId, timeZone, userId);

    return searchAssetEntries(searchContext, assetEntryQuery, start, end);
}

From source file:com.liferay.asset.publisher.web.internal.messaging.AssetEntriesCheckerUtil.java

License:Open Source License

private List<AssetEntry> _getAssetEntries(PortletPreferences portletPreferences, Layout layout)
        throws PortalException {

    AssetPublisherWebConfiguration assetPublisherWebConfiguration = _configurationProvider
            .getCompanyConfiguration(AssetPublisherWebConfiguration.class, layout.getCompanyId());

    AssetEntryQuery assetEntryQuery = AssetPublisherUtil.getAssetEntryQuery(portletPreferences,
            layout.getGroupId(), layout, null, null);

    assetEntryQuery.setEnd(assetPublisherWebConfiguration.dynamicSubscriptionLimit());
    assetEntryQuery.setStart(0);/*  ww w  .  j  a va  2  s  .  c  o m*/

    try {
        SearchContext searchContext = SearchContextFactory.getInstance(new long[0], new String[0], null,
                layout.getCompanyId(), StringPool.BLANK, layout, LocaleThreadLocal.getSiteDefaultLocale(),
                layout.getGroupId(), TimeZoneThreadLocal.getDefaultTimeZone(), 0);

        BaseModelSearchResult<AssetEntry> baseModelSearchResult = _assetHelper.searchAssetEntries(searchContext,
                assetEntryQuery, 0, assetPublisherWebConfiguration.dynamicSubscriptionLimit());

        return baseModelSearchResult.getBaseModels();
    } catch (Exception e) {
        return Collections.emptyList();
    }
}