use of com.yahoo.prelude.query.IntItem in project vespa by vespa-engine.
the class YqlParser method buildRange.
@NonNull
private Item buildRange(OperatorNode<ExpressionOperator> spec) {
assertHasOperator(spec, ExpressionOperator.CALL);
assertHasFunctionName(spec, RANGE);
IntItem range = instantiateRangeItem(spec.<List<OperatorNode<ExpressionOperator>>>getArgument(1), spec);
return leafStyleSettings(spec, range);
}
use of com.yahoo.prelude.query.IntItem in project vespa by vespa-engine.
the class YqlParser method buildLessThanOrEquals.
@NonNull
private IntItem buildLessThanOrEquals(OperatorNode<ExpressionOperator> ast) {
IntItem number;
if (isIndexOnLeftHandSide(ast)) {
number = new IntItem("[;" + fetchConditionWord(ast) + "]", fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(1, OperatorNode.class), number);
} else {
number = new IntItem("[" + fetchConditionWord(ast) + ";]", fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(0, OperatorNode.class), number);
}
return number;
}
use of com.yahoo.prelude.query.IntItem in project vespa by vespa-engine.
the class YqlParser method buildLessThan.
@NonNull
private IntItem buildLessThan(OperatorNode<ExpressionOperator> ast) {
IntItem number;
if (isIndexOnLeftHandSide(ast)) {
number = new IntItem("<" + fetchConditionWord(ast), fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(1, OperatorNode.class), number);
} else {
number = new IntItem(">" + fetchConditionWord(ast), fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(0, OperatorNode.class), number);
}
return number;
}
use of com.yahoo.prelude.query.IntItem in project vespa by vespa-engine.
the class YqlParser method buildGreaterThanOrEquals.
@NonNull
private IntItem buildGreaterThanOrEquals(OperatorNode<ExpressionOperator> ast) {
IntItem number;
if (isIndexOnLeftHandSide(ast)) {
number = new IntItem("[" + fetchConditionWord(ast) + ";]", fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(1, OperatorNode.class), number);
} else {
number = new IntItem("[;" + fetchConditionWord(ast) + "]", fetchConditionIndex(ast));
number = leafStyleSettings(ast.getArgument(0, OperatorNode.class), number);
}
return number;
}
use of com.yahoo.prelude.query.IntItem in project vespa by vespa-engine.
the class RangeQueryOptimizerTestCase method testRangeOptimizingCarriesOverItemAttributesWhenNotOptimized.
@Test
public void testRangeOptimizingCarriesOverItemAttributesWhenNotOptimized() {
Query query = new Query();
AndItem root = new AndItem();
query.getModel().getQueryTree().setRoot(root);
Item intItem = new IntItem(">" + 15, "s");
intItem.setWeight(500);
intItem.setFilter(true);
intItem.setRanked(false);
root.addItem(intItem);
assertOptimized("Not optimized", "AND |s:<15;]!500", query);
IntItem transformedIntItem = (IntItem) ((AndItem) query.getModel().getQueryTree().getRoot()).getItem(0);
assertTrue("Filter was carried over", transformedIntItem.isFilter());
assertFalse("Ranked was carried over", transformedIntItem.isRanked());
assertEquals("Weight was carried over", 500, transformedIntItem.getWeight());
}
Aggregations