Search in sources :

Example 6 with StringResultNode

use of com.yahoo.searchlib.expression.StringResultNode in project vespa by vespa-engine.

the class GroupingExecutorTestCase method requireThatGroupRelevanceCanBeSynthesized.

@Test
public void requireThatGroupRelevanceCanBeSynthesized() {
    Query query = newQuery();
    GroupingRequest req = GroupingRequest.newInstance(query);
    req.setRootOperation(GroupingOperation.fromString("all(group(foo) order(count()) each(output(count())))"));
    Grouping grp = new Grouping(0);
    grp.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new CountAggregationResult(1)).addOrderBy(new AggregationRefNode(0), true)).addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("bar")).addAggregationResult(new CountAggregationResult(2)).addOrderBy(new AggregationRefNode(0), true)));
    Result res = newExecution(new GroupingExecutor(), new ResultProvider(Arrays.asList(new GroupingListHit(Arrays.asList(grp), null), new GroupingListHit(Arrays.asList(grp), null)))).search(query);
    GroupList groupList = (GroupList) req.getResultGroup(res).get(0);
    assertEquals(1.0, groupList.get(0).getRelevance().getScore(), 1E-6);
    assertEquals(0.5, groupList.get(1).getRelevance().getScore(), 1E-6);
}
Also used : Group(com.yahoo.search.grouping.result.Group) Query(com.yahoo.search.Query) Grouping(com.yahoo.searchlib.aggregation.Grouping) AggregationRefNode(com.yahoo.searchlib.expression.AggregationRefNode) Result(com.yahoo.search.Result) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) CountAggregationResult(com.yahoo.searchlib.aggregation.CountAggregationResult) MinAggregationResult(com.yahoo.searchlib.aggregation.MinAggregationResult) MaxAggregationResult(com.yahoo.searchlib.aggregation.MaxAggregationResult) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) GroupList(com.yahoo.search.grouping.result.GroupList) CountAggregationResult(com.yahoo.searchlib.aggregation.CountAggregationResult) GroupingRequest(com.yahoo.search.grouping.GroupingRequest) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) Test(org.junit.Test)

Example 7 with StringResultNode

use of com.yahoo.searchlib.expression.StringResultNode in project vespa by vespa-engine.

the class GroupingExecutorTestCase method requireThatDefaultSummaryNameFillsHitsWithNull.

@Test
public void requireThatDefaultSummaryNameFillsHitsWithNull() {
    Query query = newQuery();
    GroupingRequest req = GroupingRequest.newInstance(query);
    req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary()))) as(foo))"));
    Grouping pass0 = new Grouping(0);
    pass0.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME))));
    Grouping pass1 = new Grouping(0);
    pass1.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, ExpressionConverter.DEFAULT_SUMMARY_NAME).addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
    Execution exec = newExecution(new GroupingExecutor(), new ResultProvider(Arrays.asList(new GroupingListHit(Arrays.asList(pass0), null), new GroupingListHit(Arrays.asList(pass1), null))));
    Result res = exec.search(query);
    exec.fill(res);
    Hit hit = ((HitList) ((Group) ((GroupList) req.getResultGroup(res).get(0)).get(0)).get(0)).get(0);
    assertTrue(hit instanceof FastHit);
    assertTrue(hit.isFilled(null));
}
Also used : Group(com.yahoo.search.grouping.result.Group) Query(com.yahoo.search.Query) HitList(com.yahoo.search.grouping.result.HitList) Grouping(com.yahoo.searchlib.aggregation.Grouping) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) Result(com.yahoo.search.Result) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) CountAggregationResult(com.yahoo.searchlib.aggregation.CountAggregationResult) MinAggregationResult(com.yahoo.searchlib.aggregation.MinAggregationResult) MaxAggregationResult(com.yahoo.searchlib.aggregation.MaxAggregationResult) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) FastHit(com.yahoo.prelude.fastsearch.FastHit) Hit(com.yahoo.search.result.Hit) Execution(com.yahoo.search.searchchain.Execution) FastHit(com.yahoo.prelude.fastsearch.FastHit) GroupList(com.yahoo.search.grouping.result.GroupList) GroupingRequest(com.yahoo.search.grouping.GroupingRequest) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) Test(org.junit.Test)

Example 8 with StringResultNode

use of com.yahoo.searchlib.expression.StringResultNode in project vespa by vespa-engine.

the class ExpressionConverter method toBucket.

private BucketResultNode toBucket(GroupingExpression exp) {
    if (!(exp instanceof BucketValue)) {
        throw new UnsupportedOperationException("Can not convert '" + exp + "' to a bucket.");
    }
    ConstantValue<?> begin = ((BucketValue) exp).getFrom();
    ConstantValue<?> end = ((BucketValue) exp).getTo();
    if (begin instanceof DoubleValue || end instanceof DoubleValue) {
        return new FloatBucketResultNode(begin instanceof InfiniteValue ? FloatResultNode.getNegativeInfinity().getFloat() : Double.valueOf(begin.toString()), end instanceof InfiniteValue ? FloatResultNode.getPositiveInfinity().getFloat() : Double.valueOf(end.toString()));
    } else if (begin instanceof LongValue || end instanceof LongValue) {
        return new IntegerBucketResultNode(begin instanceof InfiniteValue ? IntegerResultNode.getNegativeInfinity().getInteger() : Long.valueOf(begin.toString()), end instanceof InfiniteValue ? IntegerResultNode.getPositiveInfinity().getInteger() : Long.valueOf(end.toString()));
    } else if (begin instanceof StringValue || end instanceof StringValue) {
        return new StringBucketResultNode(begin instanceof InfiniteValue ? StringResultNode.getNegativeInfinity() : new StringResultNode((String) begin.getValue()), end instanceof InfiniteValue ? StringResultNode.getPositiveInfinity() : new StringResultNode((String) end.getValue()));
    } else {
        return new RawBucketResultNode(begin instanceof InfiniteValue ? RawResultNode.getNegativeInfinity() : new RawResultNode(((RawValue) begin).getValue().getBytes()), end instanceof InfiniteValue ? RawResultNode.getPositiveInfinity() : new RawResultNode(((RawValue) end).getValue().getBytes()));
    }
}
Also used : IntegerBucketResultNode(com.yahoo.searchlib.expression.IntegerBucketResultNode) BucketValue(com.yahoo.search.grouping.request.BucketValue) FloatBucketResultNode(com.yahoo.searchlib.expression.FloatBucketResultNode) InfiniteValue(com.yahoo.search.grouping.request.InfiniteValue) DoubleValue(com.yahoo.search.grouping.request.DoubleValue) RawResultNode(com.yahoo.searchlib.expression.RawResultNode) LongValue(com.yahoo.search.grouping.request.LongValue) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) StringBucketResultNode(com.yahoo.searchlib.expression.StringBucketResultNode) StringValue(com.yahoo.search.grouping.request.StringValue) RawBucketResultNode(com.yahoo.searchlib.expression.RawBucketResultNode) RawValue(com.yahoo.search.grouping.request.RawValue)

Example 9 with StringResultNode

use of com.yahoo.searchlib.expression.StringResultNode in project vespa by vespa-engine.

the class ExpressionConverter method toExpressionNode.

/**
 * Converts the given ast type grouping expression to a corresponding back-end type expression.
 *
 * @param exp The expression to convert.
 * @return The corresponding back-end expression.
 * @throws UnsupportedOperationException Thrown if the given expression could not be converted.
 */
public ExpressionNode toExpressionNode(GroupingExpression exp) {
    if (exp instanceof AddFunction) {
        return addArguments(new AddFunctionNode(), (AddFunction) exp);
    }
    if (exp instanceof AggregatorNode) {
        return new AggregationRefNode(toAggregationResult(exp));
    }
    if (exp instanceof AndFunction) {
        return addArguments(new AndFunctionNode(), (AndFunction) exp);
    }
    if (exp instanceof AttributeValue) {
        return new AttributeNode(((AttributeValue) exp).getAttributeName());
    }
    if (exp instanceof AttributeFunction) {
        return new AttributeNode(((AttributeFunction) exp).getAttributeName());
    }
    if (exp instanceof CatFunction) {
        return addArguments(new CatFunctionNode(), (CatFunction) exp);
    }
    if (exp instanceof DebugWaitFunction) {
        return new DebugWaitFunctionNode(toExpressionNode(((DebugWaitFunction) exp).getArg(0)), ((DebugWaitFunction) exp).getWaitTime(), ((DebugWaitFunction) exp).getBusyWait());
    }
    if (exp instanceof DocIdNsSpecificValue) {
        return new GetDocIdNamespaceSpecificFunctionNode();
    }
    if (exp instanceof DoubleValue) {
        return new ConstantNode(new FloatResultNode(((DoubleValue) exp).getValue()));
    }
    if (exp instanceof DivFunction) {
        return addArguments(new DivideFunctionNode(), (DivFunction) exp);
    }
    if (exp instanceof FixedWidthFunction) {
        Number w = ((FixedWidthFunction) exp).getWidth();
        return new FixedWidthBucketFunctionNode(w instanceof Double ? new FloatResultNode(w.doubleValue()) : new IntegerResultNode(w.longValue()), toExpressionNode(((FixedWidthFunction) exp).getArg(0)));
    }
    if (exp instanceof LongValue) {
        return new ConstantNode(new IntegerResultNode(((LongValue) exp).getValue()));
    }
    if (exp instanceof MaxFunction) {
        return addArguments(new MaxFunctionNode(), (MaxFunction) exp);
    }
    if (exp instanceof Md5Function) {
        return new MD5BitFunctionNode().setNumBits(((Md5Function) exp).getNumBits()).addArg(toExpressionNode(((Md5Function) exp).getArg(0)));
    }
    if (exp instanceof UcaFunction) {
        UcaFunction uca = (UcaFunction) exp;
        return new UcaFunctionNode(toExpressionNode(uca.getArg(0)), uca.getLocale(), uca.getStrength());
    }
    if (exp instanceof MinFunction) {
        return addArguments(new MinFunctionNode(), (MinFunction) exp);
    }
    if (exp instanceof ModFunction) {
        return addArguments(new ModuloFunctionNode(), (ModFunction) exp);
    }
    if (exp instanceof MulFunction) {
        return addArguments(new MultiplyFunctionNode(), (MulFunction) exp);
    }
    if (exp instanceof NegFunction) {
        return new NegateFunctionNode(toExpressionNode(((NegFunction) exp).getArg(0)));
    }
    if (exp instanceof NormalizeSubjectFunction) {
        return new NormalizeSubjectFunctionNode(toExpressionNode(((NormalizeSubjectFunction) exp).getArg(0)));
    }
    if (exp instanceof NowFunction) {
        return new ConstantNode(new IntegerResultNode(System.currentTimeMillis() / 1000));
    }
    if (exp instanceof OrFunction) {
        return addArguments(new OrFunctionNode(), (OrFunction) exp);
    }
    if (exp instanceof PredefinedFunction) {
        return new RangeBucketPreDefFunctionNode(toBucketList((PredefinedFunction) exp), toExpressionNode(((PredefinedFunction) exp).getArg(0)));
    }
    if (exp instanceof RelevanceValue) {
        return new RelevanceNode();
    }
    if (exp instanceof ReverseFunction) {
        return new ReverseFunctionNode(toExpressionNode(((ReverseFunction) exp).getArg(0)));
    }
    if (exp instanceof SizeFunction) {
        return new NumElemFunctionNode(toExpressionNode(((SizeFunction) exp).getArg(0)));
    }
    if (exp instanceof SortFunction) {
        return new SortFunctionNode(toExpressionNode(((SortFunction) exp).getArg(0)));
    }
    if (exp instanceof ArrayAtLookup) {
        ArrayAtLookup aal = (ArrayAtLookup) exp;
        return new ArrayAtLookupNode(aal.getAttributeName(), toExpressionNode(aal.getIndexArgument()));
    }
    if (exp instanceof InterpolatedLookup) {
        InterpolatedLookup sarl = (InterpolatedLookup) exp;
        return new InterpolatedLookupNode(sarl.getAttributeName(), toExpressionNode(sarl.getLookupArgument()));
    }
    if (exp instanceof StrCatFunction) {
        return addArguments(new StrCatFunctionNode(), (StrCatFunction) exp);
    }
    if (exp instanceof StringValue) {
        return new ConstantNode(new StringResultNode(((StringValue) exp).getValue()));
    }
    if (exp instanceof StrLenFunction) {
        return new StrLenFunctionNode(toExpressionNode(((StrLenFunction) exp).getArg(0)));
    }
    if (exp instanceof SubFunction) {
        return toSubNode((SubFunction) exp);
    }
    if (exp instanceof ToDoubleFunction) {
        return new ToFloatFunctionNode(toExpressionNode(((ToDoubleFunction) exp).getArg(0)));
    }
    if (exp instanceof ToLongFunction) {
        return new ToIntFunctionNode(toExpressionNode(((ToLongFunction) exp).getArg(0)));
    }
    if (exp instanceof ToRawFunction) {
        return new ToRawFunctionNode(toExpressionNode(((ToRawFunction) exp).getArg(0)));
    }
    if (exp instanceof ToStringFunction) {
        return new ToStringFunctionNode(toExpressionNode(((ToStringFunction) exp).getArg(0)));
    }
    if (exp instanceof DateFunction) {
        StrCatFunctionNode ret = new StrCatFunctionNode();
        GroupingExpression arg = ((DateFunction) exp).getArg(0);
        ret.addArg(new ToStringFunctionNode(toTime(arg, TimeStampFunctionNode.TimePart.Year)));
        ret.addArg(new ConstantNode(new StringResultNode("-")));
        ret.addArg(new ToStringFunctionNode(toTime(arg, TimeStampFunctionNode.TimePart.Month)));
        ret.addArg(new ConstantNode(new StringResultNode("-")));
        ret.addArg(new ToStringFunctionNode(toTime(arg, TimeStampFunctionNode.TimePart.MonthDay)));
        return ret;
    }
    if (exp instanceof MathSqrtFunction) {
        return new MathFunctionNode(toExpressionNode(((MathSqrtFunction) exp).getArg(0)), MathFunctionNode.Function.SQRT);
    }
    if (exp instanceof MathCbrtFunction) {
        return new MathFunctionNode(toExpressionNode(((MathCbrtFunction) exp).getArg(0)), MathFunctionNode.Function.CBRT);
    }
    if (exp instanceof MathLogFunction) {
        return new MathFunctionNode(toExpressionNode(((MathLogFunction) exp).getArg(0)), MathFunctionNode.Function.LOG);
    }
    if (exp instanceof MathLog1pFunction) {
        return new MathFunctionNode(toExpressionNode(((MathLog1pFunction) exp).getArg(0)), MathFunctionNode.Function.LOG1P);
    }
    if (exp instanceof MathLog10Function) {
        return new MathFunctionNode(toExpressionNode(((MathLog10Function) exp).getArg(0)), MathFunctionNode.Function.LOG10);
    }
    if (exp instanceof MathExpFunction) {
        return new MathFunctionNode(toExpressionNode(((MathExpFunction) exp).getArg(0)), MathFunctionNode.Function.EXP);
    }
    if (exp instanceof MathPowFunction) {
        return new MathFunctionNode(toExpressionNode(((MathPowFunction) exp).getArg(0)), MathFunctionNode.Function.POW).addArg(toExpressionNode(((MathPowFunction) exp).getArg(1)));
    }
    if (exp instanceof MathHypotFunction) {
        return new MathFunctionNode(toExpressionNode(((MathHypotFunction) exp).getArg(0)), MathFunctionNode.Function.HYPOT).addArg(toExpressionNode(((MathHypotFunction) exp).getArg(1)));
    }
    if (exp instanceof MathSinFunction) {
        return new MathFunctionNode(toExpressionNode(((MathSinFunction) exp).getArg(0)), MathFunctionNode.Function.SIN);
    }
    if (exp instanceof MathASinFunction) {
        return new MathFunctionNode(toExpressionNode(((MathASinFunction) exp).getArg(0)), MathFunctionNode.Function.ASIN);
    }
    if (exp instanceof MathCosFunction) {
        return new MathFunctionNode(toExpressionNode(((MathCosFunction) exp).getArg(0)), MathFunctionNode.Function.COS);
    }
    if (exp instanceof MathACosFunction) {
        return new MathFunctionNode(toExpressionNode(((MathACosFunction) exp).getArg(0)), MathFunctionNode.Function.ACOS);
    }
    if (exp instanceof MathTanFunction) {
        return new MathFunctionNode(toExpressionNode(((MathTanFunction) exp).getArg(0)), MathFunctionNode.Function.TAN);
    }
    if (exp instanceof MathATanFunction) {
        return new MathFunctionNode(toExpressionNode(((MathATanFunction) exp).getArg(0)), MathFunctionNode.Function.ATAN);
    }
    if (exp instanceof MathSinHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathSinHFunction) exp).getArg(0)), MathFunctionNode.Function.SINH);
    }
    if (exp instanceof MathASinHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathASinHFunction) exp).getArg(0)), MathFunctionNode.Function.ASINH);
    }
    if (exp instanceof MathCosHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathCosHFunction) exp).getArg(0)), MathFunctionNode.Function.COSH);
    }
    if (exp instanceof MathACosHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathACosHFunction) exp).getArg(0)), MathFunctionNode.Function.ACOSH);
    }
    if (exp instanceof MathTanHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathTanHFunction) exp).getArg(0)), MathFunctionNode.Function.TANH);
    }
    if (exp instanceof MathATanHFunction) {
        return new MathFunctionNode(toExpressionNode(((MathATanHFunction) exp).getArg(0)), MathFunctionNode.Function.ATANH);
    }
    if (exp instanceof MathFloorFunction) {
        return new MathFunctionNode(toExpressionNode(((MathFloorFunction) exp).getArg(0)), MathFunctionNode.Function.FLOOR);
    }
    if (exp instanceof ZCurveXFunction) {
        return new ZCurveFunctionNode(toExpressionNode(((ZCurveXFunction) exp).getArg(0)), ZCurveFunctionNode.Dimension.X);
    }
    if (exp instanceof ZCurveYFunction) {
        return new ZCurveFunctionNode(toExpressionNode(((ZCurveYFunction) exp).getArg(0)), ZCurveFunctionNode.Dimension.Y);
    }
    if (exp instanceof DayOfMonthFunction) {
        return toTime(((DayOfMonthFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.MonthDay);
    }
    if (exp instanceof DayOfWeekFunction) {
        return toTime(((DayOfWeekFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.WeekDay);
    }
    if (exp instanceof DayOfYearFunction) {
        return toTime(((DayOfYearFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.YearDay);
    }
    if (exp instanceof HourOfDayFunction) {
        return toTime(((HourOfDayFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.Hour);
    }
    if (exp instanceof MinuteOfHourFunction) {
        return toTime(((MinuteOfHourFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.Minute);
    }
    if (exp instanceof MonthOfYearFunction) {
        return toTime(((MonthOfYearFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.Month);
    }
    if (exp instanceof SecondOfMinuteFunction) {
        return toTime(((SecondOfMinuteFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.Second);
    }
    if (exp instanceof YearFunction) {
        return toTime(((YearFunction) exp).getArg(0), TimeStampFunctionNode.TimePart.Year);
    }
    if (exp instanceof XorFunction) {
        return addArguments(new XorFunctionNode(), (XorFunction) exp);
    }
    if (exp instanceof XorBitFunction) {
        return new XorBitFunctionNode().setNumBits(((XorBitFunction) exp).getNumBits()).addArg(toExpressionNode(((XorBitFunction) exp).getArg(0)));
    }
    if (exp instanceof YmumValue) {
        return new GetYMUMChecksumFunctionNode();
    }
    throw new UnsupportedOperationException("Can not convert '" + exp + "' of class " + exp.getClass().getName() + " to an expression.");
}
Also used : ArrayAtLookup(com.yahoo.search.grouping.request.ArrayAtLookup) StrLenFunctionNode(com.yahoo.searchlib.expression.StrLenFunctionNode) MD5BitFunctionNode(com.yahoo.searchlib.expression.MD5BitFunctionNode) UcaFunction(com.yahoo.search.grouping.request.UcaFunction) RelevanceValue(com.yahoo.search.grouping.request.RelevanceValue) ToIntFunctionNode(com.yahoo.searchlib.expression.ToIntFunctionNode) SubFunction(com.yahoo.search.grouping.request.SubFunction) FloatResultNode(com.yahoo.searchlib.expression.FloatResultNode) ToLongFunction(com.yahoo.search.grouping.request.ToLongFunction) IntegerResultNode(com.yahoo.searchlib.expression.IntegerResultNode) SortFunction(com.yahoo.search.grouping.request.SortFunction) SecondOfMinuteFunction(com.yahoo.search.grouping.request.SecondOfMinuteFunction) FixedWidthBucketFunctionNode(com.yahoo.searchlib.expression.FixedWidthBucketFunctionNode) SortFunctionNode(com.yahoo.searchlib.expression.SortFunctionNode) MathCosFunction(com.yahoo.search.grouping.request.MathCosFunction) StringValue(com.yahoo.search.grouping.request.StringValue) DivideFunctionNode(com.yahoo.searchlib.expression.DivideFunctionNode) DayOfYearFunction(com.yahoo.search.grouping.request.DayOfYearFunction) MonthOfYearFunction(com.yahoo.search.grouping.request.MonthOfYearFunction) YearFunction(com.yahoo.search.grouping.request.YearFunction) MinuteOfHourFunction(com.yahoo.search.grouping.request.MinuteOfHourFunction) RelevanceNode(com.yahoo.searchlib.expression.RelevanceNode) AndFunction(com.yahoo.search.grouping.request.AndFunction) MathCosHFunction(com.yahoo.search.grouping.request.MathCosHFunction) XorFunction(com.yahoo.search.grouping.request.XorFunction) PredefinedFunction(com.yahoo.search.grouping.request.PredefinedFunction) XorBitFunctionNode(com.yahoo.searchlib.expression.XorBitFunctionNode) AndFunctionNode(com.yahoo.searchlib.expression.AndFunctionNode) NegFunction(com.yahoo.search.grouping.request.NegFunction) MinFunctionNode(com.yahoo.searchlib.expression.MinFunctionNode) InterpolatedLookupNode(com.yahoo.searchlib.expression.InterpolatedLookupNode) NormalizeSubjectFunction(com.yahoo.search.grouping.request.NormalizeSubjectFunction) ToRawFunctionNode(com.yahoo.searchlib.expression.ToRawFunctionNode) MathSqrtFunction(com.yahoo.search.grouping.request.MathSqrtFunction) AggregationRefNode(com.yahoo.searchlib.expression.AggregationRefNode) MinFunction(com.yahoo.search.grouping.request.MinFunction) DebugWaitFunction(com.yahoo.search.grouping.request.DebugWaitFunction) MathTanFunction(com.yahoo.search.grouping.request.MathTanFunction) MathASinFunction(com.yahoo.search.grouping.request.MathASinFunction) ModFunction(com.yahoo.search.grouping.request.ModFunction) OrFunctionNode(com.yahoo.searchlib.expression.OrFunctionNode) MathACosHFunction(com.yahoo.search.grouping.request.MathACosHFunction) MathATanHFunction(com.yahoo.search.grouping.request.MathATanHFunction) AttributeFunction(com.yahoo.search.grouping.request.AttributeFunction) GetYMUMChecksumFunctionNode(com.yahoo.searchlib.expression.GetYMUMChecksumFunctionNode) ZCurveFunctionNode(com.yahoo.searchlib.expression.ZCurveFunctionNode) MathExpFunction(com.yahoo.search.grouping.request.MathExpFunction) CatFunction(com.yahoo.search.grouping.request.CatFunction) StrCatFunction(com.yahoo.search.grouping.request.StrCatFunction) DoubleValue(com.yahoo.search.grouping.request.DoubleValue) UcaFunctionNode(com.yahoo.searchlib.expression.UcaFunctionNode) ZCurveXFunction(com.yahoo.search.grouping.request.ZCurveXFunction) DayOfYearFunction(com.yahoo.search.grouping.request.DayOfYearFunction) AttributeValue(com.yahoo.search.grouping.request.AttributeValue) InterpolatedLookup(com.yahoo.search.grouping.request.InterpolatedLookup) MathATanFunction(com.yahoo.search.grouping.request.MathATanFunction) MathCbrtFunction(com.yahoo.search.grouping.request.MathCbrtFunction) DateFunction(com.yahoo.search.grouping.request.DateFunction) NormalizeSubjectFunctionNode(com.yahoo.searchlib.expression.NormalizeSubjectFunctionNode) NegateFunctionNode(com.yahoo.searchlib.expression.NegateFunctionNode) MathHypotFunction(com.yahoo.search.grouping.request.MathHypotFunction) ConstantNode(com.yahoo.searchlib.expression.ConstantNode) DebugWaitFunctionNode(com.yahoo.searchlib.expression.DebugWaitFunctionNode) SizeFunction(com.yahoo.search.grouping.request.SizeFunction) ToRawFunction(com.yahoo.search.grouping.request.ToRawFunction) GroupingExpression(com.yahoo.search.grouping.request.GroupingExpression) Md5Function(com.yahoo.search.grouping.request.Md5Function) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) RangeBucketPreDefFunctionNode(com.yahoo.searchlib.expression.RangeBucketPreDefFunctionNode) XorBitFunction(com.yahoo.search.grouping.request.XorBitFunction) MathTanHFunction(com.yahoo.search.grouping.request.MathTanHFunction) AddFunctionNode(com.yahoo.searchlib.expression.AddFunctionNode) AttributeNode(com.yahoo.searchlib.expression.AttributeNode) MathASinHFunction(com.yahoo.search.grouping.request.MathASinHFunction) MathSinHFunction(com.yahoo.search.grouping.request.MathSinHFunction) MathFunctionNode(com.yahoo.searchlib.expression.MathFunctionNode) MathLog1pFunction(com.yahoo.search.grouping.request.MathLog1pFunction) OrFunction(com.yahoo.search.grouping.request.OrFunction) LongValue(com.yahoo.search.grouping.request.LongValue) ZCurveYFunction(com.yahoo.search.grouping.request.ZCurveYFunction) StrCatFunction(com.yahoo.search.grouping.request.StrCatFunction) ArrayAtLookupNode(com.yahoo.searchlib.expression.ArrayAtLookupNode) HourOfDayFunction(com.yahoo.search.grouping.request.HourOfDayFunction) YmumValue(com.yahoo.search.grouping.request.YmumValue) MultiplyFunctionNode(com.yahoo.searchlib.expression.MultiplyFunctionNode) ToStringFunctionNode(com.yahoo.searchlib.expression.ToStringFunctionNode) DayOfMonthFunction(com.yahoo.search.grouping.request.DayOfMonthFunction) FixedWidthFunction(com.yahoo.search.grouping.request.FixedWidthFunction) NowFunction(com.yahoo.search.grouping.request.NowFunction) DocIdNsSpecificValue(com.yahoo.search.grouping.request.DocIdNsSpecificValue) MathPowFunction(com.yahoo.search.grouping.request.MathPowFunction) MathACosFunction(com.yahoo.search.grouping.request.MathACosFunction) StrCatFunctionNode(com.yahoo.searchlib.expression.StrCatFunctionNode) CatFunctionNode(com.yahoo.searchlib.expression.CatFunctionNode) AggregatorNode(com.yahoo.search.grouping.request.AggregatorNode) StrCatFunctionNode(com.yahoo.searchlib.expression.StrCatFunctionNode) AddFunction(com.yahoo.search.grouping.request.AddFunction) ToDoubleFunction(com.yahoo.search.grouping.request.ToDoubleFunction) MathSinFunction(com.yahoo.search.grouping.request.MathSinFunction) GetDocIdNamespaceSpecificFunctionNode(com.yahoo.searchlib.expression.GetDocIdNamespaceSpecificFunctionNode) MaxFunction(com.yahoo.search.grouping.request.MaxFunction) NumElemFunctionNode(com.yahoo.searchlib.expression.NumElemFunctionNode) ReverseFunctionNode(com.yahoo.searchlib.expression.ReverseFunctionNode) DayOfWeekFunction(com.yahoo.search.grouping.request.DayOfWeekFunction) ModuloFunctionNode(com.yahoo.searchlib.expression.ModuloFunctionNode) StrLenFunction(com.yahoo.search.grouping.request.StrLenFunction) MathFloorFunction(com.yahoo.search.grouping.request.MathFloorFunction) MathLog10Function(com.yahoo.search.grouping.request.MathLog10Function) ToStringFunction(com.yahoo.search.grouping.request.ToStringFunction) MathLogFunction(com.yahoo.search.grouping.request.MathLogFunction) XorFunctionNode(com.yahoo.searchlib.expression.XorFunctionNode) ReverseFunction(com.yahoo.search.grouping.request.ReverseFunction) ToFloatFunctionNode(com.yahoo.searchlib.expression.ToFloatFunctionNode) DivFunction(com.yahoo.search.grouping.request.DivFunction) MaxFunctionNode(com.yahoo.searchlib.expression.MaxFunctionNode) MulFunction(com.yahoo.search.grouping.request.MulFunction) MonthOfYearFunction(com.yahoo.search.grouping.request.MonthOfYearFunction)

Example 10 with StringResultNode

use of com.yahoo.searchlib.expression.StringResultNode in project vespa by vespa-engine.

the class GroupingExecutorTestCase method requireThatUnfilledHitsRenderError.

@Test
public void requireThatUnfilledHitsRenderError() throws IOException {
    Query query = newQuery();
    GroupingRequest req = GroupingRequest.newInstance(query);
    req.setRootOperation(GroupingOperation.fromString("all(group(foo) each(each(output(summary(bar)))))"));
    Grouping grp0 = new Grouping(0);
    grp0.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, "bar"))));
    Grouping grp1 = new Grouping(0);
    grp1.setRoot(new com.yahoo.searchlib.aggregation.Group().addChild(new com.yahoo.searchlib.aggregation.Group().setId(new StringResultNode("foo")).addAggregationResult(new HitsAggregationResult(1, "bar").addHit(new com.yahoo.searchlib.aggregation.FS4Hit()))));
    Execution exec = newExecution(new GroupingExecutor(), new ResultProvider(Arrays.asList(new GroupingListHit(Arrays.asList(grp0), null), new GroupingListHit(Arrays.asList(grp1), null))), new FillErrorProvider());
    Result res = exec.search(query);
    exec.fill(res);
    assertNotNull(res.hits().getError());
}
Also used : Group(com.yahoo.search.grouping.result.Group) Query(com.yahoo.search.Query) Grouping(com.yahoo.searchlib.aggregation.Grouping) GroupingListHit(com.yahoo.prelude.fastsearch.GroupingListHit) Result(com.yahoo.search.Result) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) CountAggregationResult(com.yahoo.searchlib.aggregation.CountAggregationResult) MinAggregationResult(com.yahoo.searchlib.aggregation.MinAggregationResult) MaxAggregationResult(com.yahoo.searchlib.aggregation.MaxAggregationResult) HitsAggregationResult(com.yahoo.searchlib.aggregation.HitsAggregationResult) Execution(com.yahoo.search.searchchain.Execution) GroupingRequest(com.yahoo.search.grouping.GroupingRequest) StringResultNode(com.yahoo.searchlib.expression.StringResultNode) Test(org.junit.Test)

Aggregations

StringResultNode (com.yahoo.searchlib.expression.StringResultNode)11 GroupingListHit (com.yahoo.prelude.fastsearch.GroupingListHit)9 Query (com.yahoo.search.Query)9 GroupingRequest (com.yahoo.search.grouping.GroupingRequest)9 Group (com.yahoo.search.grouping.result.Group)9 Grouping (com.yahoo.searchlib.aggregation.Grouping)9 Test (org.junit.Test)9 Execution (com.yahoo.search.searchchain.Execution)8 MaxAggregationResult (com.yahoo.searchlib.aggregation.MaxAggregationResult)7 HitsAggregationResult (com.yahoo.searchlib.aggregation.HitsAggregationResult)6 MinAggregationResult (com.yahoo.searchlib.aggregation.MinAggregationResult)6 Result (com.yahoo.search.Result)5 FastHit (com.yahoo.prelude.fastsearch.FastHit)4 CountAggregationResult (com.yahoo.searchlib.aggregation.CountAggregationResult)4 GroupList (com.yahoo.search.grouping.result.GroupList)3 Hit (com.yahoo.search.result.Hit)3 IntegerResultNode (com.yahoo.searchlib.expression.IntegerResultNode)3 DocumentId (com.yahoo.document.DocumentId)2 GlobalId (com.yahoo.document.GlobalId)2 DoubleValue (com.yahoo.search.grouping.request.DoubleValue)2