Examples of FunctionValues


Examples of org.apache.lucene.queries.function.FunctionValues

      final FakeScorer scorer = new FakeScorer();
      Map<String, Scorer> context = new HashMap<String, Scorer>();
      context.put("scorer", scorer);

      final FunctionValues fvalues = valueSource.getValues(context, matchingDocs.context);
      final int length = matchingDocs.bits.length();
      final float[] aggValues = facetArrays.getFloatArray();
      int doc = 0;
      int scoresIdx = 0;
      while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
        scorer.docID = doc;
        scorer.score = matchingDocs.scores[scoresIdx++];
        cli.getOrdinals(doc, ordinals);
        final int upto = ordinals.offset + ordinals.length;
        float val = (float) fvalues.doubleVal(doc);
        for (int i = ordinals.offset; i < upto; i++) {
          aggValues[ordinals.ints[i]] += val;
        }
        ++doc;
      }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

      final CategoryListIterator cli = clp.createCategoryListIterator(0);
      if (!cli.setNextReader(matchingDocs.context)) {
        return;
      }

      final FunctionValues fvalues = valueSource.getValues(Collections.emptyMap(), matchingDocs.context);
      final int length = matchingDocs.bits.length();
      final float[] aggValues = facetArrays.getFloatArray();
      int doc = 0;
      while (doc < length && (doc = matchingDocs.bits.nextSetBit(doc)) != -1) {
        cli.getOrdinals(doc, ordinals);
        final int upto = ordinals.offset + ordinals.length;
        float val = (float) fvalues.doubleVal(doc);
        for (int i = ordinals.offset; i < upto; i++) {
          aggValues[ordinals.ints[i]] += val;
        }
        ++doc;
      }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

    List<FacetResult> results = new ArrayList<FacetResult>();
    for (FacetRequest req : searchParams.facetRequests) {
      RangeFacetRequest<?> rangeFR = (RangeFacetRequest<?>) req;
      int[] counts = new int[rangeFR.ranges.length];
      for (MatchingDocs hits : matchingDocs) {
        FunctionValues fv = rangeFR.getValues(hits.context);
        final int length = hits.bits.length();
        int doc = 0;
        while (doc < length && (doc = hits.bits.nextSetBit(doc)) != -1) {
          // Skip missing docs:
          if (!fv.exists(doc)) {
            ++doc;
            continue;
          }
         
          long v = fv.longVal(doc);

          // TODO: if all ranges are non-overlapping, we
          // should instead do a bin-search up front
          // (really, a specialized case of the interval
          // tree)
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

  }

  @Override
  public FunctionValues getValues(Map context, AtomicReaderContext readerContext) throws IOException {
    final int base = readerContext.docBase;
    final FunctionValues vals = source.getValues(context,readerContext);
    return new FunctionValues() {

      @Override
      public double doubleVal(int doc) {
        Integer key = Integer.valueOf( base+doc );
        Double v = cache.get( key );
        if( v == null ) {
          v = Double.valueOf( vals.doubleVal(doc) );
          cache.put( key, v );
        }
        return v.doubleValue();
      }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

  }

  @Override
  public void setNextReader(AtomicReaderContext context) throws IOException {
    this.readerContext = context;
    FunctionValues values = groupBy.getValues(vsContext, context);
    filler = values.getValueFiller();
    mval = filler.getValue();

    for (GroupHead groupHead : groups.values()) {
      for (int i = 0; i < groupHead.comparators.length; i++) {
        groupHead.comparators[i] = groupHead.comparators[i].setNextReader(context);
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

    }
  }

  @Override
  public void setNextReader(AtomicReaderContext context) throws IOException {
    FunctionValues values = groupBy.getValues(vsContext, context);
    filler = values.getValueFiller();
    mval = filler.getValue();
  }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

    }
  }

  @Override
  public void setNextReader(AtomicReaderContext context) throws IOException {
    FunctionValues values = groupSource.getValues(vsContext, context);
    groupFiller = values.getValueFiller();
    groupMval = groupFiller.getValue();
    values = countSource.getValues(vsContext, context);
    countFiller = values.getValueFiller();
    countMval = countFiller.getValue();
  }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

    }
    FunctionValues[] externalValues = new FunctionValues[expression.variables.length];

    for (int i = 0; i < variables.length; ++i) {
      String externalName = expression.variables[i];
      FunctionValues values = valuesCache.get(externalName);
      if (values == null) {
        values = variables[i].getValues(context, readerContext);
        if (values == null) {
          throw new RuntimeException("Internal error. External (" + externalName + ") does not exist.");
        }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

   * If this method fails to compile, you also have to change the byte code generator to correctly
   * use the FunctionValues class.
   */
  @SuppressWarnings({"unused", "null"})
  private static void unusedTestCompile() {
    FunctionValues f = null;
    double ret = f.doubleVal(2);
  }
View Full Code Here

Examples of org.apache.lucene.queries.function.FunctionValues

    float minVal = Float.POSITIVE_INFINITY;
    float maxVal = Float.NEGATIVE_INFINITY;

    for (AtomicReaderContext leaf : leaves) {
      int maxDoc = leaf.reader().maxDoc();
      FunctionValues vals =  source.getValues(context, leaf);
      for (int i=0; i<maxDoc; i++) {

      float val = vals.floatVal(i);
      if ((Float.floatToRawIntBits(val) & (0xff<<23)) == 0xff<<23) {
        // if the exponent in the float is all ones, then this is +Inf, -Inf or NaN
        // which don't make sense to factor into the scale function
        continue;
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.