Class WildcardQuery

  • All Implemented Interfaces:
    java.lang.Cloneable

    public class WildcardQuery
    extends AutomatonQuery
    Implements the wildcard search query. Supported wildcards are *, which matches any character sequence (including the empty one), and ?, which matches any single character. '\' is the escape character.

    Note this query can be slow, as it needs to iterate over many terms. In order to prevent extremely slow WildcardQueries, a Wildcard term should not start with the wildcard *

    This query uses the MultiTermQuery.CONSTANT_SCORE_AUTO_REWRITE_DEFAULT rewrite method.

    See Also:
    AutomatonQuery
    • Field Detail

      • WILDCARD_STRING

        public static final char WILDCARD_STRING
        String equality with support for wildcards
        See Also:
        Constant Field Values
      • WILDCARD_CHAR

        public static final char WILDCARD_CHAR
        Char equality with support for wildcards
        See Also:
        Constant Field Values
      • WILDCARD_ESCAPE

        public static final char WILDCARD_ESCAPE
        Escape character
        See Also:
        Constant Field Values
    • Constructor Detail

      • WildcardQuery

        public WildcardQuery​(Term term)
        Constructs a query for terms matching term.
    • Method Detail

      • toAutomaton

        public static Automaton toAutomaton​(Term wildcardquery)
        Convert Lucene wildcard syntax into an automaton.
      • getTerm

        public Term getTerm()
        Returns the pattern term.
      • toString

        public java.lang.String toString​(java.lang.String field)
        Prints a user-readable version of this query.
        Overrides:
        toString in class AutomatonQuery