本文整理汇总了Java中org.apache.lucene.facet.search.FacetArrays.getIntArray方法的典型用法代码示例。如果您正苦于以下问题:Java FacetArrays.getIntArray方法的具体用法?Java FacetArrays.getIntArray怎么用?Java FacetArrays.getIntArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.lucene.facet.search.FacetArrays
的用法示例。
在下文中一共展示了FacetArrays.getIntArray方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initArraysByTotalCounts
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
/** Init arrays for partition by total counts, optionally applying a factor */
private final void initArraysByTotalCounts(FacetArrays facetArrays, int partition, int nAccumulatedDocs) {
int[] intArray = facetArrays.getIntArray();
totalFacetCounts.fillTotalCountsForPartition(intArray, partition);
double totalCountsFactor = getTotalCountsFactor();
// fix total counts, but only if the effect of this would be meaningful.
if (totalCountsFactor < 0.99999) {
int delta = nAccumulatedDocs + 1;
for (int i = 0; i < intArray.length; i++) {
intArray[i] *= totalCountsFactor;
// also translate to prevent loss of non-positive values
// due to complement sampling (ie if sampled docs all decremented a certain category).
intArray[i] += delta;
}
}
}
示例2: 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());
}
}
示例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 + CategoryIntAssociation.ASSOCIATION_LIST_ID);
if (dv == null) {
return; // no int associations in this reader
}
final int length = matchingDocs.bits.length();
final int[] values = facetArrays.getIntArray();
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 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] += value;
}
++doc;
}
}
示例4: 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 + CategoryIntAssociation.ASSOCIATION_LIST_ID);
if (dv == null) {
return; // no int associations in this reader
}
final int length = matchingDocs.bits.length();
final int[] values = facetArrays.getIntArray();
int doc = 0;
while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
dv.get(doc, bytes);
if (bytes.length > 0) {
// aggreate 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] += value;
}
}
++doc;
}
}
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:30,代码来源:SumIntAssociationFacetsAggregator.java
示例5: getValueOf
import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public double getValueOf(FacetArrays arrays, int ordinal) {
return arrays.getIntArray()[ordinal];
}