當前位置: 首頁>>代碼示例>>Java>>正文


Java FacetResult類代碼示例

本文整理匯總了Java中org.jai.search.model.FacetResult的典型用法代碼示例。如果您正苦於以下問題:Java FacetResult類的具體用法?Java FacetResult怎麽用?Java FacetResult使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


FacetResult類屬於org.jai.search.model包,在下文中一共展示了FacetResult類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getRandomFilters

import org.jai.search.model.FacetResult; //導入依賴的package包/類
private Map<String, Set<String>> getRandomFilters(
		final ProductSearchResult searchProducts) {
	final Map<String, Set<String>> filters = new LinkedHashMap<String, Set<String>>();
	// Add once
	final FacetResult facetResult = searchProducts.getFacets().get(
			new Random().nextInt(6));
	FacetResultEntry facetResultEntry = null;
	if (facetResult.getFacetResultEntries().size() > 1) {
		facetResultEntry = facetResult.getFacetResultEntries().get(
				new Random().nextInt(facetResult.getFacetResultEntries()
						.size() - 1));
	} else {
		facetResultEntry = facetResult.getFacetResultEntries().get(0);
	}
	final Set<String> list = new HashSet<String>();
	list.add(facetResultEntry.getTerm());
	filters.put(facetResult.getCode(), list);
	// try randomly again
	secondfilter: if (new Random().nextBoolean()) {
		final FacetResult facetResult2 = searchProducts.getFacets().get(
				new Random().nextInt(6));
		FacetResultEntry facetResultEntry2 = null;
		// if no entries, break the label.
		if (facetResult2.getFacetResultEntries().size() == 0) {
			break secondfilter;
		}
		if (facetResult2.getFacetResultEntries().size() > 1) {
			facetResultEntry2 = facetResult2.getFacetResultEntries().get(
					new Random().nextInt(facetResult2
							.getFacetResultEntries().size() - 1));
		} else {
			facetResultEntry2 = facetResult2.getFacetResultEntries().get(0);
		}
		final Set<String> list2 = new HashSet<String>();
		list2.add(facetResultEntry2.getTerm());
		final String key2 = facetResult2.getCode();
		if (filters.containsKey(key2)) {
			filters.get(key2).add(facetResultEntry2.getTerm());
		} else {
			filters.put(key2, list2);
		}
	}
	return filters;
}
 
開發者ID:jaibeermalik,項目名稱:searchanalytics-bigdata,代碼行數:45,代碼來源:GenerateSearchAnalyticsDataImpl.java


注:本文中的org.jai.search.model.FacetResult類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。