Class WildcardPattern
java.lang.Object
org.elasticsearch.xpack.esql.core.expression.predicate.regex.AbstractStringPattern
org.elasticsearch.xpack.esql.core.expression.predicate.regex.WildcardPattern
- All Implemented Interfaces:
Writeable,StringPattern,NodeStringRenderable
Similar to basic regex, supporting '?' wildcard for single character (same as regex ".")
and '*' wildcard for multiple characters (same as regex ".*")
Allows escaping based on a regular char.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceClassification of aWildcardPatterninto the simple fast-path shapes.Nested classes/interfaces inherited from interface org.elasticsearch.common.io.stream.Writeable
Writeable.Reader<V>, Writeable.Writer<V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns the pattern in (IndexNameExpressionResolver) wildcard format.Returns the pattern in (Java) regex format.Returns the pattern in (Lucene) wildcard format.protected org.apache.lucene.util.automaton.AutomatondoCreateAutomaton(boolean ignoreCase) booleaninthashCode()voidnodeString(StringBuilder sb, Node.NodeStringFormat format, NodeStringMapper mapper) Renders the wildcard quoted, routing literal runs throughmapper.columnwhile keeping the wildcard metacharacters (* ? % _) and escapes structural.pattern()Returns the pattern as it was defined by the user.shape()Classify this pattern into one of the affix-only fast-path shapes, unwrapping backslash escapes in a single pass.voidwriteTo(StreamOutput out) Methods inherited from class org.elasticsearch.xpack.esql.core.expression.predicate.regex.AbstractStringPattern
createAutomaton, exactMatch, extractPrefix, extractSuffix, matchesAll
-
Constructor Details
-
WildcardPattern
-
WildcardPattern
- Throws:
IOException
-
-
Method Details
-
writeTo
- Specified by:
writeToin interfaceWriteable- Throws:
IOException
-
pattern
Description copied from interface:StringPatternReturns the pattern as it was defined by the user.- Specified by:
patternin interfaceStringPattern
-
nodeString
Renders the wildcard quoted, routing literal runs throughmapper.columnwhile keeping the wildcard metacharacters (* ? % _) and escapes structural. UnderNodeStringMapper.IDENTITYthis reproduces the raw pattern.- Specified by:
nodeStringin interfaceNodeStringRenderable- Overrides:
nodeStringin classAbstractStringPattern
-
doCreateAutomaton
protected org.apache.lucene.util.automaton.Automaton doCreateAutomaton(boolean ignoreCase) - Specified by:
doCreateAutomatonin classAbstractStringPattern
-
asJavaRegex
Description copied from interface:StringPatternReturns the pattern in (Java) regex format.- Specified by:
asJavaRegexin interfaceStringPattern
-
asLuceneWildcard
Returns the pattern in (Lucene) wildcard format. -
asIndexNameWildcard
Returns the pattern in (IndexNameExpressionResolver) wildcard format. -
shape
Classify this pattern into one of the affix-only fast-path shapes, unwrapping backslash escapes in a single pass. The result is one ofWildcardPattern.Shape.Prefix,WildcardPattern.Shape.Suffix,WildcardPattern.Shape.Contains, orWildcardPattern.Shape.General.INSTANCE. The first three carry the literal segment so callers can dispatch to astartsWith/endsWith/ substring-search evaluator without building anAutomaton;Generalsignals that the pattern does not match any simple shape (multiple unescaped*s with text between them, any unescaped?, escaped-only patterns with no wildcards, dangling backslashes, etc.) and the caller should fall back to the automaton path. -
hashCode
public int hashCode() -
equals
-