use of io.crate.lucene.match.CrateRegexQuery in project crate by crate.
the class RegexpMatchOperator method toQuery.
@Override
public Query toQuery(Reference ref, Literal<?> literal, Context context) {
String pattern = (String) literal.value();
Term term = new Term(ref.column().fqn(), pattern);
if (RegexpFlags.isPcrePattern(pattern)) {
return new CrateRegexQuery(term);
} else {
return new ConstantScoreQuery(new RegexpQuery(term, RegExp.ALL));
}
}
Aggregations