Class AutomatonQuery

  • All Implemented Interfaces:
    Cloneable
    Direct Known Subclasses:
    RegexpQuery, WildcardQuery

    public class AutomatonQuery
    extends MultiTermQuery
    A Query that will match terms against a finite-state machine.

    This query will match documents that contain terms accepted by a given finite-state machine. The automaton can be constructed with the org.apache.lucene.util.automaton API. Alternatively, it can be created from a regular expression with RegexpQuery or from the standard Lucene wildcard syntax with WildcardQuery.

    When the query is executed, it will create an equivalent DFA of the finite-state machine, and will enumerate the term dictionary in an intelligent way to reduce the number of comparisons. For example: the regular expression of [dl]og? will make approximately four comparisons: do, dog, lo, and log.

    • Field Detail

      • automaton

        protected final Automaton automaton
        the automaton to match index terms against
      • term

        protected final Term term
        term containing the field, and possibly some pattern structure
    • Constructor Detail

      • AutomatonQuery

        public AutomatonQuery​(Term term,
                              Automaton automaton)
        Create a new AutomatonQuery from an Automaton.
        Parameters:
        term - Term containing field and possibly some pattern structure. The term text is ignored.
        automaton - Automaton to run, terms that are accepted are considered a match.