use of com.yahoo.prelude.query.RegExpItem in project vespa by vespa-engine.
the class YqlParserTestCase method testRegexp.
@Test
public void testRegexp() {
QueryTree x = parse("select * from sources * where foo matches \"a b\";");
Item root = x.getRoot();
assertSame(RegExpItem.class, root.getClass());
assertEquals("a b", ((RegExpItem) root).stringValue());
}
use of com.yahoo.prelude.query.RegExpItem in project vespa by vespa-engine.
the class YqlParser method buildRegExpSearch.
@NonNull
private Item buildRegExpSearch(OperatorNode<ExpressionOperator> ast) {
assertHasOperator(ast, ExpressionOperator.MATCHES);
String field = getIndex(ast.<OperatorNode<ExpressionOperator>>getArgument(0));
OperatorNode<ExpressionOperator> ast1 = ast.<OperatorNode<ExpressionOperator>>getArgument(1);
String wordData = getStringContents(ast1);
RegExpItem regExp = new RegExpItem(field, true, wordData);
return leafStyleSettings(ast1, regExp);
}
Aggregations