Search in sources :

Example 6 with IntItem

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);
}
Also used : IntItem(com.yahoo.prelude.query.IntItem) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Example 7 with IntItem

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;
}
Also used : IntItem(com.yahoo.prelude.query.IntItem) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Example 8 with IntItem

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;
}
Also used : IntItem(com.yahoo.prelude.query.IntItem) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Example 9 with IntItem

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;
}
Also used : IntItem(com.yahoo.prelude.query.IntItem) NonNull(edu.umd.cs.findbugs.annotations.NonNull)

Example 10 with IntItem

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());
}
Also used : IntItem(com.yahoo.prelude.query.IntItem) Item(com.yahoo.prelude.query.Item) AndItem(com.yahoo.prelude.query.AndItem) IntItem(com.yahoo.prelude.query.IntItem) Query(com.yahoo.search.Query) AndItem(com.yahoo.prelude.query.AndItem) Test(org.junit.Test)

Aggregations

IntItem (com.yahoo.prelude.query.IntItem)21 Test (org.junit.Test)12 AndItem (com.yahoo.prelude.query.AndItem)11 Item (com.yahoo.prelude.query.Item)9 NonNull (edu.umd.cs.findbugs.annotations.NonNull)7 CompositeItem (com.yahoo.prelude.query.CompositeItem)5 WordItem (com.yahoo.prelude.query.WordItem)5 Query (com.yahoo.search.Query)5 NotItem (com.yahoo.prelude.query.NotItem)4 OrItem (com.yahoo.prelude.query.OrItem)4 PhraseItem (com.yahoo.prelude.query.PhraseItem)4 PhraseSegmentItem (com.yahoo.prelude.query.PhraseSegmentItem)4 PrefixItem (com.yahoo.prelude.query.PrefixItem)4 RankItem (com.yahoo.prelude.query.RankItem)4 SubstringItem (com.yahoo.prelude.query.SubstringItem)4 SuffixItem (com.yahoo.prelude.query.SuffixItem)4 RangeItem (com.yahoo.prelude.query.RangeItem)2 LazyMap (com.yahoo.collections.LazyMap)1 AndSegmentItem (com.yahoo.prelude.query.AndSegmentItem)1 DotProductItem (com.yahoo.prelude.query.DotProductItem)1