本文整理汇总了Java中org.apache.lucene.facet.search.FacetArrays.getFloatArray方法的典型用法代码示例。如果您正苦于以下问题:Java FacetArrays.getFloatArray方法的具体用法?Java FacetArrays.getFloatArray怎么用?Java FacetArrays.getFloatArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.facet.search.FacetArrays
的用法示例。
在下文中一共展示了FacetArrays.getFloatArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAggregator
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
protected Aggregator createAggregator(FacetRequest fr, FacetArrays facetArrays) {
if (fr instanceof CountFacetRequest) {
// we rely on that, if needed, result is cleared by arrays!
int[] a = facetArrays.getIntArray();
if (isUsingComplements) {
return new ComplementCountingAggregator(a);
} else {
return new CountingAggregator(a);
}
} else if (fr instanceof SumScoreFacetRequest) {
if (isUsingComplements) {
throw new IllegalArgumentException("complements are not supported by SumScoreFacetRequest");
} else {
return new ScoringAggregator(facetArrays.getFloatArray());
}
} else if (fr instanceof OverSampledFacetRequest) {
return createAggregator(((OverSampledFacetRequest) fr).orig, facetArrays);
} else {
throw new IllegalArgumentException("unknown Aggregator implementation for request " + fr.getClass());
}
}
示例2: aggregate
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public void aggregate(MatchingDocs matchingDocs, CategoryListParams clp, FacetArrays facetArrays) throws IOException {
BinaryDocValues dv = matchingDocs.context.reader().getBinaryDocValues(clp.field + CategoryFloatAssociation.ASSOCIATION_LIST_ID);
if (dv == null) {
return; // no float associations in this reader
}
final int length = matchingDocs.bits.length();
final float[] values = facetArrays.getFloatArray();
int doc = 0;
while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
dv.get(doc, bytes);
if (bytes.length == 0) {
continue; // no associations for this document
}
// aggreate float association values for ordinals
int bytesUpto = bytes.offset + bytes.length;
int pos = bytes.offset;
while (pos < bytesUpto) {
int ordinal = ((bytes.bytes[pos++] & 0xFF) << 24) | ((bytes.bytes[pos++] & 0xFF) << 16)
| ((bytes.bytes[pos++] & 0xFF) << 8) | (bytes.bytes[pos++] & 0xFF);
int value = ((bytes.bytes[pos++] & 0xFF) << 24) | ((bytes.bytes[pos++] & 0xFF) << 16)
| ((bytes.bytes[pos++] & 0xFF) << 8) | (bytes.bytes[pos++] & 0xFF);
values[ordinal] += Float.intBitsToFloat(value);
}
++doc;
}
}
示例3: aggregate
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public void aggregate(MatchingDocs matchingDocs, CategoryListParams clp, FacetArrays facetArrays) throws IOException {
BinaryDocValues dv = matchingDocs.context.reader().getBinaryDocValues(clp.field + CategoryFloatAssociation.ASSOCIATION_LIST_ID);
if (dv == null) {
return; // no float associations in this reader
}
final int length = matchingDocs.bits.length();
final float[] values = facetArrays.getFloatArray();
int doc = 0;
while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
dv.get(doc, bytes);
if (bytes.length > 0) {
// aggreate float association values for ordinals
int bytesUpto = bytes.offset + bytes.length;
int pos = bytes.offset;
while (pos < bytesUpto) {
int ordinal = ((bytes.bytes[pos++] & 0xFF) << 24) | ((bytes.bytes[pos++] & 0xFF) << 16)
| ((bytes.bytes[pos++] & 0xFF) << 8) | (bytes.bytes[pos++] & 0xFF);
int value = ((bytes.bytes[pos++] & 0xFF) << 24) | ((bytes.bytes[pos++] & 0xFF) << 16)
| ((bytes.bytes[pos++] & 0xFF) << 8) | (bytes.bytes[pos++] & 0xFF);
values[ordinal] += Float.intBitsToFloat(value);
}
}
++doc;
}
}
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:30,代码来源:SumFloatAssociationFacetsAggregator.java
示例4: rollupValues
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public void rollupValues(FacetRequest fr, int ordinal, int[] children, int[] siblings, FacetArrays facetArrays) {
float[] values = facetArrays.getFloatArray();
values[ordinal] += rollupValues(children[ordinal], children, siblings, values);
}
示例5: getValueOf
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public double getValueOf(FacetArrays arrays, int ordinal) {
return arrays.getFloatArray()[ordinal];
}