• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Hits类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



Hits类属于com.liferay.portal.kernel.search包,在下文中一共展示了Hits类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: getSortedRecords

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
private List<DDLRecord> getSortedRecords(final HttpServletRequest request, final DDLRecordSet recordSet,
        final String sortByStructureColumnName) throws Exception {

    DDMStructure structure = recordSet.getDDMStructure();
    String indexedSortColumn = DDMIndexerUtil.encodeName(structure.getStructureId(), sortByStructureColumnName, Locale.US);

    SearchContext searchContext = SearchContextFactory.getInstance(request);
    String fieldType = structure.getFieldType(sortByStructureColumnName);
    int sortType = getSortType(fieldType);

    Sort sort = SortFactoryUtil.create(indexedSortColumn, sortType, false);

    searchContext.setSorts(sort);
    Indexer indexer = IndexerRegistryUtil.getIndexer("com.liferay.portlet.dynamicdatalists.util.DDLIndexer");
    Hits results = indexer.search(searchContext);

    return adapt(results);
}
 
开发者ID:permeance,项目名称:liferay-sample-ddl-sort-example,代码行数:19,代码来源:SamplePortletController.java


示例2: getTaskRecords

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
public static List<TaskRecord> getTaskRecords(Hits hits) {

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

        List<TaskRecord> taskRecords = new ArrayList<TaskRecord>();

        for (Document document : documents) {
            try {
                long taskRecordId = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));

                TaskRecord taskRecord = TaskRecordLocalServiceUtil.getTaskRecord(taskRecordId);
                taskRecords.add(taskRecord);

            } catch (Exception e) {

                if (_log.isErrorEnabled()) {
                    _log.error(e.getMessage());
                }
            }
        }

        return taskRecords;
    }
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:24,代码来源:TimetrackerUtil.java


示例3: getContacts

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
public static List<Contact> getContacts(Hits hits) {

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

        List<Contact> taskRecords = new ArrayList<Contact>();

        for (Document document : documents) {
            try {
                long taskRecordId = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));

                Contact taskRecord = ContactLocalServiceUtil.getContact(taskRecordId);
                taskRecords.add(taskRecord);

            } catch (Exception e) {

                if (_log.isErrorEnabled()) {
                    _log.error(e.getMessage());
                }
            }
        }

        return taskRecords;
    }
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:24,代码来源:ContactUtil.java


示例4: searchLucene

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
public Hits searchLucene(LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
		SearchContext searchContext) throws ParseException, SearchException {
	String keywords = (String) params.get(Field.KEYWORD_SEARCH);
	String groupId = (String) params.get(Field.GROUP_ID);

	Indexer<Registration> indexer = IndexerRegistryUtil.nullSafeGetIndexer(Registration.class);

	searchContext.addFullQueryEntryClassName(CLASS_NAME);
	searchContext.setEntryClassNames(new String[] { CLASS_NAME });
	searchContext.setAttribute("paginationType", "regular");
	searchContext.setLike(true);
	searchContext.setStart(start);
	searchContext.setEnd(end);
	searchContext.setAndSearch(true);
	searchContext.setSorts(sorts);

	BooleanQuery booleanQuery = null;

	if (Validator.isNotNull(keywords)) {
		booleanQuery = BooleanQueryFactoryUtil.create(searchContext);
	} else {
		booleanQuery = indexer.getFullQuery(searchContext);
	}

	if (Validator.isNotNull(groupId)) {
		MultiMatchQuery query = new MultiMatchQuery(groupId);

		query.addFields(Field.GROUP_ID);

		booleanQuery.add(query, BooleanClauseOccur.MUST);
	}


	booleanQuery.addRequiredTerm(Field.ENTRY_CLASS_NAME, CLASS_NAME);

	return IndexSearcherHelperUtil.search(searchContext, booleanQuery);
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:38,代码来源:RegistrationLogLocalServiceImpl.java


示例5: getFormDataById

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
	public JSONObject getFormDataById(long companyId, LinkedHashMap<String, Object> params, Sort[] sorts, int start, int end,
			ServiceContext serviceContext) {
		JSONObject result = JSONFactoryUtil.createJSONObject();
		
		Hits hits = null;
		
		SearchContext searchContext = new SearchContext();
		searchContext.setCompanyId(companyId);
		
		try {
			
			hits = DeliverableLocalServiceUtil.searchLucene(params, sorts, start, end, searchContext);
			
			result.put("data", hits.toList());
			
//			long total = DeliverableLocalServiceUtil.countLucene(params, searchContext);
//			
//			result.put("total", total);
			
		} catch (Exception e) {
			_log.error(e);
		}
		
		return result;
	}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:27,代码来源:DeliverableActionsImpl.java


示例6: getServiceProcesses

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public JSONObject getServiceProcesses(long userId, long companyId, long groupId, LinkedHashMap<String, Object> params,
		Sort[] sorts, int start, int end, ServiceContext serviceContext) throws PortalException {
	JSONObject result = JSONFactoryUtil.createJSONObject();

	Hits hits = null;
	long count = 0;

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

	hits = ServiceProcessLocalServiceUtil.searchLucene(params, sorts, start, end, searchContext);
	count = ServiceProcessLocalServiceUtil.countLucene(params, searchContext);

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

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


示例7: getProcessSteps

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public JSONObject getProcessSteps(long userId, long companyId, long groupId, LinkedHashMap<String, Object> params,
		Sort[] sorts, int start, int end, ServiceContext serviceContext) throws PortalException {

	JSONObject results = JSONFactoryUtil.createJSONObject();

	Hits hits = null;
	long count = 0;

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

	hits = ProcessStepLocalServiceUtil.searchLucene(params, sorts, start, end, searchContext);
	count = ProcessStepLocalServiceUtil.countLucene(params, searchContext);

	results.put("total", count);
	results.put("data", hits.toList());

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


示例8: getProcessActions

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public JSONObject getProcessActions(long userId, long companyId, long groupId, LinkedHashMap<String, Object> params,
		Sort[] sorts, int start, int end, ServiceContext serviceContext) throws PortalException {
	JSONObject results = JSONFactoryUtil.createJSONObject();

	Hits hits = null;
	long count = 0;

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

	hits = ProcessActionLocalServiceUtil.searchLucene(params, sorts, start, end, searchContext);
	count = ProcessActionLocalServiceUtil.searchCount(params, searchContext);

	results.put("total", count);
	results.put("data", hits.toList());

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


示例9: getDossierStatistic

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public JSONObject getDossierStatistic(long userId, long companyId, long groupId, LinkedHashMap<String, Object> params,
		Sort[] sorts, int start, int end, ServiceContext serviceContext) {
	JSONObject result = JSONFactoryUtil.createJSONObject();

	Hits hits = null;

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

	try {

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

		result.put("data", hits.toList());
		result.put("total", hits.toList().size());

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

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


示例10: addMeasurement

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
private int addMeasurement(ServiceContext serviceContext, long userId,
        JSONObject data, String id, String name, Date timestamp,
        String unit, String value) throws Exception {

    Hits hits = _measurementLocalService.search(userId,
            serviceContext.getScopeGroupId(), null, id, null, null,
            timestamp, null, null, null, true, 0, 1, null);

    if (hits.getLength() == 0) {

        _measurementLocalService.addMeasurement(userId, data.toString(), id,
                name, timestamp, unit, value, serviceContext);

        return IMPORTED;

    } else {

        return IGNORED;
    }
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:21,代码来源:MeasurementImportController.java


示例11: getMeasurements

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
public static List<Measurement> getMeasurements(Hits hits) {

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

        List<Measurement> measurements = new ArrayList<Measurement>();

        for (Document document : documents) {
            try {
                long measurementId = GetterUtil.getLong(document.get(Field.ENTRY_CLASS_PK));

                Measurement measurement = MeasurementLocalServiceUtil.getMeasurement(measurementId);
                measurements.add(measurement);

            } catch (Exception e) {

                if (_log.isErrorEnabled()) {
                    _log.error(e.getMessage());
                }
            }
        }

        return measurements;
    }
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:24,代码来源:MeasurementUtil.java


示例12: search

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public Hits search(SearchContext searchContext, Query query) throws SearchException {
    try {
        int end = searchContext.getEnd();
        int start = searchContext.getStart();
        if (isFilterSearch(searchContext)) {
            if (end > INDEX_FILTER_SEARCH_LIMIT) {
                end = end - INDEX_FILTER_SEARCH_LIMIT + 5;
            }
            if ((start < 0) || (start > end) || end < 0) {
                return new HitsImpl();
            }
        }
        query = getPermissionQuery(searchContext, query);

        return doSearch(searchContext, query, start, end);
    } catch (Exception e) {
        throw new SearchException(e);
    }
}
 
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:21,代码来源:ElasticsearchIndexSearcher.java


示例13: doSearch

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
private Hits doSearch(SearchContext searchContext, Query query, int start, int end) {
    Client client = getClient();

    SearchRequestBuilder searchRequestBuilder = prepareSearchBuilder(searchContext, query, client, start, end);
    _log.debug("Current lucene version:  " + Version.LUCENE_CURRENT);
    _log.debug("Search query String  " + searchRequestBuilder.toString());
    SearchRequest searchRequest = searchRequestBuilder.request();
    _log.debug("Time Before request to ES: " + System.currentTimeMillis());
    ActionFuture<SearchResponse> future = client.search(searchRequest);
    SearchResponse searchResponse = future.actionGet();
    _log.debug("Time After response from ES: " + System.currentTimeMillis());
    updateFacetCollectors(searchContext, searchResponse);
    Hits hits = processSearchHits(
            searchResponse, query.getQueryConfig());
    _log.debug("Total responseCount  " + searchResponse.getHits().getTotalHits());
    _log.debug("Time After processSearchHits: " + System.currentTimeMillis());

    hits.setQuery(query);

    TimeValue timeValue = searchResponse.getTook();

    hits.setSearchTime((float) timeValue.getSecondsFrac());
    return hits;
}
 
开发者ID:R-Knowsys,项目名称:elasticray,代码行数:25,代码来源:ElasticsearchIndexSearcher.java


示例14: search

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public Hits search(long userId, long groupId, long ownerUserId, String workPackage, String description, int status,
        Date fromDate, Date untilDate, LinkedHashMap<String, Object> params, boolean andSearch, boolean advancedSearch, int start, int end,
        Sort sort) throws PortalException {

    return taskRecordLocalService.search(userId, groupId, ownerUserId, workPackage, description, status, fromDate,
            untilDate, params, andSearch, advancedSearch, start, end, sort);

}
 
开发者ID:inofix,项目名称:ch-inofix-timetracker,代码行数:10,代码来源:TaskRecordServiceImpl.java


示例15: search

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public Hits search(long userId, long groupId, long ownerUserId, String company, String fullName, int status,
        LinkedHashMap<String, Object> params, boolean andSearch, int start, int end, Sort sort)
        throws PortalException {

    return contactLocalService.search(userId, groupId, ownerUserId, company, fullName, status, params, andSearch,
            start, end, sort);
}
 
开发者ID:inofix,项目名称:ch-inofix-contact-manager,代码行数:9,代码来源:ContactServiceImpl.java


示例16: 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


示例17: getFormDataByFormNo

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public JSONObject getFormDataByFormNo(long userId, long companyId, LinkedHashMap<String, Object> params, Sort[] object, int start,
		int end, ServiceContext serviceContext) {
	// TODO Auto-generated method stub
	JSONObject result = JSONFactoryUtil.createJSONObject();
	
	Hits hits = null;
	_log.info("companyId:"+companyId);
	SearchContext searchContext = new SearchContext();
	searchContext.setCompanyId(companyId);
	
	try {
		
		hits = RegistrationFormLocalServiceUtil.searchLucene(params, object, start, end, searchContext);
		
		result.put("data", hits.toList());
		
		long total = RegistrationFormLocalServiceUtil.countLucene(params, searchContext);
		
		result.put("total", total);
		
	} catch (Exception e) {
		_log.error(e);
	}
	
	return result;
}
 
开发者ID:VietOpenCPS,项目名称:opencps-v2,代码行数:28,代码来源:RegistrationActionsImpl.java


示例18: execute

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
/**
 * Execute search.
 * 
 * @param searchContext
 * @param query
 * @return Hits
 * @throws Exception
 */
@SuppressWarnings("unchecked")
protected Hits execute(SearchContext searchContext, Query query)
	throws Exception {

	if (_log.isDebugEnabled()) {
		_log.debug("Executing search with query: " + query.toString());
	}
	
	BooleanClause<?> booleanClause = BooleanClauseFactoryUtil.create(
		query, BooleanClauseOccur.MUST.getName());
	
	searchContext.setBooleanClauses(new BooleanClause[] {
		booleanClause
	});

	Hits hits = _indexSearcherHelper.search(searchContext, query);

	if (_log.isDebugEnabled()) {
		_log.debug("Query: " + hits.getQuery());
		_log.debug("Hits: " + hits.getLength());
		_log.debug("Returned: " + hits.getDocs().length);
		_log.debug("Time:" + hits.getSearchTime());
		_log.debug(
			"Suggestions size: " + hits.getQuerySuggestions().length);
	}
	return hits;
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:36,代码来源:GSearchImpl.java


示例19: process

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public boolean process(
	SearchContext searchContext,
	QueryParams queryParams, Hits hits)
	throws Exception {

	if (_log.isDebugEnabled()) {
		_log.debug("Processing QueryIndexer");
	}

	if (!_gSearchConfiguration.enableQuerySuggestions() &&
		!_gSearchConfiguration.enableAutoComplete()) {
		return true;
	}

	if (_log.isDebugEnabled()) {
		_log.debug("QueryIndexer is enabled");
	}
	
	if (hits.getLength() >= _gSearchConfiguration.queryIndexingThreshold()) {

		if (_log.isDebugEnabled()) {
			_log.debug("QueryIndexing threshold exceeded. Indexing keywords: " + queryParams.getKeywords());
		}

		addDocument(
			queryParams.getCompanyId(), queryParams.getKeywords(),
			queryParams.getLocale());
	} else {
		if (_log.isDebugEnabled()) {
			_log.debug("QueryIndexing threshold wasn't exceeded. Not indexing keywords.");
		}
	}
	return true;
}
 
开发者ID:peerkar,项目名称:liferay-gsearch,代码行数:36,代码来源:QueryIndexerProcessorImpl.java


示例20: search

import com.liferay.portal.kernel.search.Hits; //导入依赖的package包/类
@Override
public Hits search(long userId, long groupId, String keywords, int start,
        int end, Sort sort) throws PortalException {

    return measurementLocalService.search(userId, groupId, keywords, start,
            end, sort);
}
 
开发者ID:inofix,项目名称:ch-inofix-data-manager,代码行数:8,代码来源:MeasurementServiceImpl.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DescribeKeyPairsRequest类代码示例发布时间:2022-05-22
下一篇:
Java WebAsyncTask类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap