当前位置: 首页>>代码示例>>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;未经允许,请勿转载。