org.elasticsearch.index.query.RegexpFlag Java Examples

The following examples show how to use org.elasticsearch.index.query.RegexpFlag. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LuceneQueryBuilder.java    From Elasticsearch with Apache License 2.0 5 votes vote down vote up
@Override
protected Query applyArrayReference(Reference arrayReference, Literal literal, Context context) throws IOException {
    String regexString = LikeOperator.patternToRegex(BytesRefs.toString(literal.value()), LikeOperator.DEFAULT_ESCAPE, false);
    regexString = regexString.substring(1, regexString.length() - 1);
    String notLike = negateWildcard(regexString);

    return new RegexpQuery(new Term(
            arrayReference.info().ident().columnIdent().fqn(),
            notLike),
            RegexpFlag.COMPLEMENT.value()
    );
}
 
Example #2
Source File: AnyNotLikeQuery.java    From crate with Apache License 2.0 5 votes vote down vote up
@Override
protected Query literalMatchesAnyArrayRef(Literal candidate, Reference array, LuceneQueryBuilder.Context context) throws IOException {
    String regexString = LikeOperators.patternToRegex((String) candidate.value(), LikeOperators.DEFAULT_ESCAPE, false);
    regexString = regexString.substring(1, regexString.length() - 1);
    String notLike = negateWildcard(regexString);

    return new RegexpQuery(new Term(
        array.column().fqn(),
        notLike),
        RegexpFlag.COMPLEMENT.value()
    );
}