本文整理汇总了Java中org.apache.solr.client.solrj.response.RangeFacet类的典型用法代码示例。如果您正苦于以下问题:Java RangeFacet类的具体用法?Java RangeFacet怎么用?Java RangeFacet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RangeFacet类属于org.apache.solr.client.solrj.response包,在下文中一共展示了RangeFacet类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: extractFacetCounts
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
/**
* Extracts {@link FacetCount}s associated with {@link XField}
* from solr {@link QueryResponse response}.
* It supports extracting from solr range facets and field facets.
*/
public List<FacetCount> extractFacetCounts(QueryResponse response, XField xField) {
Preconditions.checkNotNull(response);
Preconditions.checkNotNull(xField);
String fieldName = xFieldNameMapper.mapXField(xField);
RangeFacet<?, ?> facetRange = extractRangeFacet(response, fieldName);
FacetField facetField = extractFieldFacet(response, fieldName);
if (facetRange != null) {
return convertRangeFacetCounts(facetRange);
}
if (facetField != null) {
return convertFieldFacetCounts(facetField);
}
throw new RuntimeException("No field or range facet for field name " + fieldName + " in solr query response");
}
开发者ID:CeON,项目名称:saos,代码行数:26,代码来源:XFieldFacetExtractor.java
示例2: RangeFacetResults
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
public RangeFacetResults(RangeFacet<B, G> rangeFacet, Function<Range<R>, F> transformFunc, Field<?> field) {
super(field);
ImmutableList.Builder<Count<Range<R>, F>> builder = ImmutableList.builder();
G gap = rangeFacet.getGap();
B rangeEnd = rangeFacet.getEnd();
for (RangeFacet.Count count : rangeFacet.getCounts()) {
R start = unmarshall(count.getValue());
R end = getRangeEnd(start, gap, rangeEnd);
//Default range inclusion is "lower"
//lower bound inclusive, upper bound exclusive
Range<R> range = Range.closedOpen(start, end);
F formattedValue = transformFunc.apply(range);
builder.add(new RangeCount<R, F>(field, range, formattedValue, Long.valueOf(count.getCount())));
}
values = builder.build();
}
开发者ID:semantico,项目名称:rigel,代码行数:20,代码来源:RangeFacetResults.java
示例3: build
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
@Override
public FacetKey<Range<Integer>, F> build() {
FacetKey<Range<Integer>, F> key = new FacetKey<Range<Integer>, F>(field, transformFunc) {
@Override
protected FacetResults<Range<Integer>, F> buildFacetResults(QueryResponse response) {
RangeFacet.Numeric rangeFacet = (RangeFacet.Numeric) rangeFacetsByName(response).get(field.getFieldName());
checkNotNull(rangeFacet, "Query didnt return range facet: " + field.getFieldName());
return new RangeFacetResults.IntegerFacet<F>(rangeFacet, transformFunc, field);
}
@Override
protected void addToSolrQuery(SolrQuery q) {
q.addNumericRangeFacet(field.getFieldName(), start, end, gap);
}
};
facets.add(key);
return key;
}
开发者ID:semantico,项目名称:rigel,代码行数:20,代码来源:Search.java
示例4: getRangeFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
@JsonIgnore
public RangeFacet getRangeFacet(String facetName) {
for(RangeFacet rangeFacet : queryResponse.getFacetRanges()) {
if(rangeFacet.getName().equals(facetName)) {
return rangeFacet;
}
}
return null;
}
开发者ID:RBGKew,项目名称:eMonocot,代码行数:10,代码来源:AbstractPageImpl.java
示例5: getFacetNames
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
/**
* @return a list of the calculated facet names
*/
@JsonIgnore
public List<String> getFacetNames() {
List<String> facetNames = new ArrayList<String>();
for(FacetField facetField : queryResponse.getFacetFields()) {
facetNames.add(facetField.getName());
}
for(RangeFacet facetRange : queryResponse.getFacetRanges()) {
facetNames.add(facetRange.getName());
}
Collections.sort(facetNames, new FacetNameComparator());
return facetNames;
}
开发者ID:RBGKew,项目名称:eMonocot,代码行数:16,代码来源:AbstractPageImpl.java
示例6: extractRangeFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
private RangeFacet<?, ?> extractRangeFacet(QueryResponse response, String fieldName) {
if (response.getFacetRanges() == null) {
return null;
}
return response.getFacetRanges()
.stream()
.filter(rf -> fieldName.equals(rf.getName()))
.findFirst().orElse(null);
}
开发者ID:CeON,项目名称:saos,代码行数:10,代码来源:XFieldFacetExtractor.java
示例7: convertRangeFacetCounts
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
private List<FacetCount> convertRangeFacetCounts(RangeFacet<?, ?> rangeFacet) {
List<FacetCount> facetCounts = Lists.newLinkedList();
for (RangeFacet.Count count : rangeFacet.getCounts()) {
facetCounts.add(new FacetCount(count.getValue(), count.getCount()));
}
return facetCounts;
}
开发者ID:CeON,项目名称:saos,代码行数:10,代码来源:XFieldFacetExtractor.java
示例8: rangeFacetsByName
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
protected Map<String, RangeFacet<?,?>> rangeFacetsByName(QueryResponse response) {
Builder<String, RangeFacet<?,?>> builder = ImmutableMap.builder();
for (RangeFacet<?,?> facet : response.getFacetRanges()) {
builder.put(facet.getName(), facet);
}
return builder.build();
}
开发者ID:semantico,项目名称:rigel,代码行数:8,代码来源:Search.java
示例9: IntegerFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
public IntegerFacet(RangeFacet<Number, Number> rangeFacet,
Function<Range<Integer>, F> transformFunc, Field<?> field) {
super(rangeFacet, transformFunc, field);
}
开发者ID:semantico,项目名称:rigel,代码行数:5,代码来源:RangeFacetResults.java
示例10: LongFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
public LongFacet(RangeFacet<Number, Number> rangeFacet,
Function<Range<Long>, F> transformFunc, Field<?> field) {
super(rangeFacet, transformFunc, field);
}
开发者ID:semantico,项目名称:rigel,代码行数:5,代码来源:RangeFacetResults.java
示例11: DateFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
public DateFacet(RangeFacet<Date, String> rangeFacet,
Function<Range<Date>, F> transformFunc, Field<?> field) {
super(rangeFacet, transformFunc, field);
}
开发者ID:semantico,项目名称:rigel,代码行数:5,代码来源:RangeFacetResults.java
示例12: getRangeFacet
import org.apache.solr.client.solrj.response.RangeFacet; //导入依赖的package包/类
RangeFacet getRangeFacet(String facetName);
开发者ID:RBGKew,项目名称:eMonocot,代码行数:2,代码来源:Page.java
注:本文中的org.apache.solr.client.solrj.response.RangeFacet类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论