java.lang.Object
org.elasticsearch.xpack.esql.core.expression.predicate.regex.AbstractStringPattern
All Implemented Interfaces:
StringPattern, NodeStringRenderable
Direct Known Subclasses:
RLikePattern, RLikePatternList, WildcardPattern, WildcardPatternList

public abstract class AbstractStringPattern extends Object implements StringPattern, NodeStringRenderable
  • Constructor Details

    • AbstractStringPattern

      public AbstractStringPattern()
  • Method Details

    • nodeString

      public void nodeString(StringBuilder sb, Node.NodeStringFormat format, NodeStringMapper mapper)
      Default-safe rendering: quote the whole pattern and route it through the mapper as a single identifier token. Subclasses override to preserve structure (wildcard / regex metacharacters, list shape). Under NodeStringMapper.IDENTITY this is the raw quoted pattern.
      Specified by:
      nodeString in interface NodeStringRenderable
    • createAutomaton

      public final org.apache.lucene.util.automaton.Automaton createAutomaton(boolean ignoreCase)
    • doCreateAutomaton

      protected abstract org.apache.lucene.util.automaton.Automaton doCreateAutomaton(boolean ignoreCase)
    • matchesAll

      public boolean matchesAll()
      Description copied from interface: StringPattern
      Hint method on whether this pattern matches everything or not.
      Specified by:
      matchesAll in interface StringPattern
    • exactMatch

      public String exactMatch()
      Description copied from interface: StringPattern
      Returns the match if this pattern is exact, that is has no wildcard or other patterns inside. If the pattern is not exact, null is returned.
      Specified by:
      exactMatch in interface StringPattern
    • extractPrefix

      public String extractPrefix()
      Returns the longest string that prefixes every string accepted by this pattern, using Lucene's Operations.getCommonPrefix(org.apache.lucene.util.automaton.Automaton). Returns null if the common prefix is empty (e.g. the pattern starts with a wildcard).
    • extractSuffix

      public String extractSuffix()
      Returns the longest string that suffixes every string accepted by this pattern. Computed by reversing the automaton and extracting the common prefix of the reversed language, then reversing the result. Returns null if the common suffix is empty or the reversed automaton is too complex to determinize.