当前位置: 首页>>代码示例>>Java>>正文


Java Hits.toList方法代码示例

本文整理汇总了Java中com.liferay.portal.kernel.search.Hits.toList方法的典型用法代码示例。如果您正苦于以下问题:Java Hits.toList方法的具体用法?Java Hits.toList怎么用?Java Hits.toList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.liferay.portal.kernel.search.Hits的用法示例。


在下文中一共展示了Hits.toList方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getPaymentFileDetail

import com.liferay.portal.kernel.search.Hits; //导入方法依赖的package包/类
/**
 * Get detail PaymentFile of DossierId and referenceUid
 * 
 * @param dossierId
 * @param referenceUid
 * @return List<Document>
 */
@Override
public List<Document> getPaymentFileDetail(long dossierId, String referenceUid, long companyId, long groupId,
		Sort[] sorts, int start, int end, ServiceContext serviceContext) {

	List<Document> result = null;

	Hits hits = null;

	SearchContext searchContext = new SearchContext();
	searchContext.setCompanyId(companyId);

	LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();
	params.put(Field.GROUP_ID, String.valueOf(groupId));
	params.put(DossierTerm.DOSSIER_ID, String.valueOf(dossierId));
	params.put(PaymentFileTerm.REFERENCE_UID, referenceUid);

	try {

		hits = PaymentFileLocalServiceUtil.searchLucene(params, sorts, start, end, searchContext);

		result = hits.toList();

	} catch (Exception e) {
		_log.error(e);
	}

	return result;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:36,代码来源:PaymentFileActionsImpl.java

示例2: getStatisticByAdministration

import com.liferay.portal.kernel.search.Hits; //导入方法依赖的package包/类
@Override
public JSONObject getStatisticByAdministration(ServiceContext context, long groupId)
		throws ParseException, SearchException {

	JSONObject result = JSONFactoryUtil.createJSONObject();
	JSONArray data = JSONFactoryUtil.createJSONArray();

	long count = 0;

	SearchContext searchContext = new SearchContext();
	searchContext.setCompanyId(context.getCompanyId());

	LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();

	LinkedHashMap<String, Object> paramsData = new LinkedHashMap<String, Object>();

	params.put(Field.GROUP_ID, String.valueOf(groupId));

	paramsData.put(Field.GROUP_ID, String.valueOf(groupId));
	paramsData.put(DictItemTerm.DICT_COLLECTION_CODE, DataMGTConstants.ADMINTRATION_CODE);

	Sort[] sorts = new Sort[] { SortFactoryUtil.create(StringPool.BLANK + "_sortable", Sort.STRING_TYPE, true) };

	Hits hits = DictItemLocalServiceUtil.luceneSearchEngine(paramsData, sorts, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			searchContext);

	List<Document> documents = hits.toList();

	for (Document doc : documents) {

		long admCount = 0;

		params.put(ServiceInfoTerm.ADMINISTRATION_CODE, doc.get(DictItemTerm.ITEM_CODE));

		admCount = ServiceInfoLocalServiceUtil.countLucene(params, searchContext);

		if (admCount != 0) {
			count = admCount + count;

			JSONObject elm = JSONFactoryUtil.createJSONObject();

			elm.put("administrationCode", doc.get(DictItemTerm.ITEM_CODE));
			elm.put("administrationName", doc.get(DictItemTerm.ITEM_NAME));
			elm.put("count", admCount);

			data.put(elm);
		}

		result.put("total", count);
		result.put("data", data);

	}

	return result;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:56,代码来源:ServiceInfoActionsImpl.java

示例3: getStatisticByDomain

import com.liferay.portal.kernel.search.Hits; //导入方法依赖的package包/类
@Override
public JSONObject getStatisticByDomain(ServiceContext context, long groupId)
		throws ParseException, SearchException {
	JSONObject result = JSONFactoryUtil.createJSONObject();
	JSONArray data = JSONFactoryUtil.createJSONArray();

	long count = 0;

	SearchContext searchContext = new SearchContext();
	searchContext.setCompanyId(context.getCompanyId());

	LinkedHashMap<String, Object> params = new LinkedHashMap<String, Object>();

	LinkedHashMap<String, Object> paramsData = new LinkedHashMap<String, Object>();

	params.put(Field.GROUP_ID, String.valueOf(groupId));

	paramsData.put(Field.GROUP_ID, String.valueOf(groupId));
	paramsData.put(DictItemTerm.DICT_COLLECTION_CODE, DataMGTConstants.SERVICE_DOMAIN);

	Sort[] sorts = new Sort[] { SortFactoryUtil.create(StringPool.BLANK + "_sortable", Sort.STRING_TYPE, true) };

	Hits hits = DictItemLocalServiceUtil.luceneSearchEngine(paramsData, sorts, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
			searchContext);

	List<Document> documents = hits.toList();

	for (Document doc : documents) {

		long admCount = 0;

		params.put(ServiceInfoTerm.DOMAIN_CODE, doc.get(DictItemTerm.ITEM_CODE));

		admCount = ServiceInfoLocalServiceUtil.countLucene(params, searchContext);

		if (admCount != 0) {
			count = admCount + count;

			JSONObject elm = JSONFactoryUtil.createJSONObject();

			elm.put("domainCode", doc.get(DictItemTerm.ITEM_CODE));
			elm.put("domainName", doc.get(DictItemTerm.ITEM_NAME));
			elm.put("count", admCount);

			data.put(elm);
		}

		result.put("total", count);
		result.put("data", data);

	}

	return result;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:55,代码来源:ServiceInfoActionsImpl.java


注:本文中的com.liferay.portal.kernel.search.Hits.toList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。