本文整理汇总了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;
}
示例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;
}
示例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;
}