use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class YqlParserTestCase method testWordAlternatives.
@Test
public void testWordAlternatives() {
QueryTree x = parse("select * from sources * where foo contains alternatives({\"trees\": 1.0, \"tree\": 0.7});");
Item root = x.getRoot();
assertSame(WordAlternativesItem.class, root.getClass());
WordAlternativesItem alternatives = (WordAlternativesItem) root;
checkWordAlternativesContent(alternatives);
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class YqlParserTestCase method testWordAlternativesWithOrigin.
@Test
public void testWordAlternativesWithOrigin() {
QueryTree x = parse("select * from sources * where foo contains" + " ([{\"origin\": {\"original\": \" trees \", \"offset\": 1, \"length\": 5}}]" + "alternatives({\"trees\": 1.0, \"tree\": 0.7}));");
Item root = x.getRoot();
assertSame(WordAlternativesItem.class, root.getClass());
WordAlternativesItem alternatives = (WordAlternativesItem) root;
checkWordAlternativesContent(alternatives);
Substring origin = alternatives.getOrigin();
assertEquals(1, origin.start);
assertEquals(6, origin.end);
assertEquals("trees", origin.getValue());
assertEquals(" trees ", origin.getSuperstring());
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testNumberAsSuffix.
@Test
public void testNumberAsSuffix() {
Item root = tester.assertParsed("*89", "*89", Query.Type.ANY);
assertTrue(root instanceof SuffixItem);
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testNegativeWordsParsing2.
@Test
public void testNegativeWordsParsing2() {
Item root = tester.assertParsed("+a -b", "+a -b", Query.Type.WEB);
assertTrue(((NotItem) root).getItem(0).isProtected());
assertTrue(((NotItem) root).getItem(1).isProtected());
}
use of com.yahoo.prelude.query.Item in project vespa by vespa-engine.
the class ParseTestCase method testLong.
@Test
public void testLong() {
Item number = tester.assertParsed("3000000000000", "3000000000000", Query.Type.ALL);
assertTrue(number instanceof IntItem);
}
Aggregations