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


Java FacetField.getName方法代码示例

本文整理汇总了Java中org.apache.solr.client.solrj.response.FacetField.getName方法的典型用法代码示例。如果您正苦于以下问题:Java FacetField.getName方法的具体用法?Java FacetField.getName怎么用?Java FacetField.getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.solr.client.solrj.response.FacetField的用法示例。


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

示例1: processFacetResults

import org.apache.solr.client.solrj.response.FacetField; //导入方法依赖的package包/类
/**
 * Add any faceting results to the result builder.
 *
 * @param resultsBuilder query result builder
 * @param facetFields faceting results
 */
protected void processFacetResults(QueryResults.Builder<QR> resultsBuilder, List<FacetField> facetFields) {
    if (facetFields != null) {
        for (FacetField facetField : facetFields) {
            String fieldName = facetField.getName();

            List<FacetCount> facetCounts = new ArrayList<>();
            for (FacetField.Count count : facetField.getValues()) {
                facetCounts.add(new FacetCount(count.getName(), count.getCount()));
            }

            FacetResult facetResult = new FacetResult(fieldName, facetCounts);
            resultsBuilder.addFacetResult(facetResult);
        }
    }
}
 
开发者ID:bbende,项目名称:tripod,代码行数:22,代码来源:SolrService.java

示例2: removeSelectedValsFromResponse

import org.apache.solr.client.solrj.response.FacetField; //导入方法依赖的package包/类
private  List<FacetField> removeSelectedValsFromResponse(QueryFacetsSelection query, List<FacetField> response){
	List<FacetField> cleanedFacets = new ArrayList<>();
	
	//for each facet from response
	for(FacetField facet: response){
		FacetSelection facetSelection = query.getSelectionValues(facet.getName());
		
		if(facetSelection == null){
			cleanedFacets.add(facet);
			continue;
		}else{
 		Collection<String> selectedValues =  facetSelection.getValues();
 		
 		FacetField _newFacetField = new FacetField(facet.getName(), facet.getName(), facet.getEnd());
 		//for each value from facet check if is selected and if not add it to the new response
 		for(Count val: facet.getValues()){
 			if(!selectedValues.contains(val.getName()))
 				_newFacetField.add(val.getName(), val.getCount());
 		}
 		
 		cleanedFacets.add(_newFacetField);
		}
	}
	
	return cleanedFacets;
}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:27,代码来源:SolrFacetFieldsService.java

示例3: removeSelected

import org.apache.solr.client.solrj.response.FacetField; //导入方法依赖的package包/类
private FacetField removeSelected(FacetField facetField, FacetSelection selection) {
    FacetField filtered = new FacetField(facetField.getName());
    if (selection != null
            && selection.getSelectionType() == FacetSelectionType.AND) {
        //we want to exclude the selected option(s) in case of an AND selection
        for (FacetField.Count value : facetField.getValues()) {
            final String valueName = value.getName();
            if (selection.getValues().contains(valueName)
                    //exclude negative value selectors
                    //(not such a great solution, added to make availability facet checkboxes work)
                    && selection.getQualifier(valueName) != FacetSelectionValueQualifier.NOT
                    ) {
                continue;
            } else {
                filtered.add(valueName, value.getCount());
            }
        }
        return filtered;
    } else {
        return facetField;
    }

}
 
开发者ID:acdh-oeaw,项目名称:vlo-curation,代码行数:24,代码来源:FacetFieldsModel.java

示例4: extractAvailableFilters

import org.apache.solr.client.solrj.response.FacetField; //导入方法依赖的package包/类
private Map<String, FacetList> extractAvailableFilters(QueryResponse response) {
	Map<String, FacetList> facets = new HashMap<String, FacetList>();

	if (response.getFacetFields() != null) {
		for (FacetField ff : response.getFacetFields()) {
			String field = ff.getName();
			List<Facet> facetList = new ArrayList<Facet>(ff.getValueCount());

			for (Count c : ff.getValues()) {
				if (c.getCount() > 0) {
					Facet f = new Facet(ff.getName(), c.getName(), c.getCount());
					facetList.add(f);
				}
			}

			facets.put(ff.getName(), new FacetList(field, getFacetLabel(field), facetList));
		}
	}

	return facets;
}
 
开发者ID:flaxsearch,项目名称:hackday,代码行数:22,代码来源:SolrSearchEngine.java

示例5: convertFacetQueryResponseToFacetPageMap

import org.apache.solr.client.solrj.response.FacetField; //导入方法依赖的package包/类
static Map<Field, Page<FacetFieldEntry>> convertFacetQueryResponseToFacetPageMap(FacetQuery query,
		QueryResponse response) {
	Assert.notNull(query, "Cannot convert response for 'null', query");

	if (!hasFacets(query, response)) {
		return Collections.emptyMap();
	}
	Map<Field, Page<FacetFieldEntry>> facetResult = new HashMap<Field, Page<FacetFieldEntry>>();

	if (CollectionUtils.isNotEmpty(response.getFacetFields())) {
		int initalPageSize = query.getFacetOptions().getPageable().getPageSize();
		for (FacetField facetField : response.getFacetFields()) {
			if (facetField != null && StringUtils.hasText(facetField.getName())) {
				Field field = new SimpleField(facetField.getName());
				if (CollectionUtils.isNotEmpty(facetField.getValues())) {
					List<FacetFieldEntry> pageEntries = new ArrayList<FacetFieldEntry>(initalPageSize);
					for (Count count : facetField.getValues()) {
						if (count != null) {
							pageEntries.add(new SimpleFacetFieldEntry(field, count.getName(), count.getCount()));
						}
					}
					facetResult.put(field, new SolrResultPage<FacetFieldEntry>(pageEntries, query.getFacetOptions()
							.getPageable(), facetField.getValueCount(), null));
				} else {
					facetResult.put(field, new SolrResultPage<FacetFieldEntry>(Collections.<FacetFieldEntry> emptyList(), query
							.getFacetOptions().getPageable(), 0, null));
				}
			}
		}
	}
	return facetResult;
}
 
开发者ID:ramaava,项目名称:spring-data-solr,代码行数:33,代码来源:ResultHelper.java


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