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


Java FacetArrays.getFloatArray方法代码示例

本文整理汇总了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());
  }
}
 
开发者ID:jimaguere,项目名称:Maskana-Gestor-de-Conocimiento,代码行数:22,代码来源:OldFacetsAccumulator.java

示例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;
  }
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:33,代码来源:SumFloatAssociationFacetsAggregator.java

示例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);
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:6,代码来源:SumIntAssociationFacetsAggregator.java

示例5: getValueOf

import org.apache.lucene.facet.search.FacetArrays; //导入方法依赖的package包/类
@Override
public double getValueOf(FacetArrays arrays, int ordinal) {
  return arrays.getFloatArray()[ordinal];
}
 
开发者ID:pkarmstr,项目名称:NYBC,代码行数:5,代码来源:AssociationFloatSumFacetRequest.java


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