Java 类org.elasticsearch.index.query.RegexpFlag 实例源码

项目:elasticsearch_my    文件:RegexOptionsTests.java   
public static RegexOptions randomRegexOptions() {
    final RegexOptions.Builder builder = RegexOptions.builder();
    maybeSet(builder::setMaxDeterminizedStates, randomIntBetween(1, 1000));
    StringBuilder sb = new StringBuilder();
    for (RegexpFlag regexpFlag : RegexpFlag.values()) {
        if (randomBoolean()) {
            if (sb.length() != 0) {
                sb.append("|");
            }
            sb.append(regexpFlag.name());
        }
    }
    maybeSet(builder::setFlags, sb.toString());
    return builder.build();
}
项目:Elasticsearch    文件:LuceneQueryBuilder.java   
@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()
    );
}
项目:elasticsearch_my    文件:RegexOptions.java   
/**
 * Sets the regular expression syntax flags
 * see {@link RegexpFlag}
 */
public Builder setFlags(String flags) {
    this.flagsValue = RegexpFlag.resolveValue(flags);
    return this;
}