org.apache.lucene.search

Class TermAutomatonQuery

    • Method Detail

      • createState

        public int createState()
        Returns a new state; state 0 is always the initial state.
      • setAccept

        public void setAccept(int state,
                              boolean accept)
        Marks the specified state as accept or not.
      • addTransition

        public void addTransition(int source,
                                  int dest,
                                  String term)
        Adds a transition to the automaton.
      • addTransition

        public void addTransition(int source,
                                  int dest,
                                  BytesRef term)
        Adds a transition to the automaton.
      • addAnyTransition

        public void addAnyTransition(int source,
                                     int dest)
        Adds a transition matching any term.
      • finish

        public void finish()
        Call this once you are done adding states/transitions.
      • finish

        public void finish(int maxDeterminizedStates)
        Call this once you are done adding states/transitions.
        Parameters:
        maxDeterminizedStates - Maximum number of states created when determinizing the automaton. Higher numbers allow this operation to consume more memory but allow more complex automatons.
      • toString

        public String toString(String field)
        Description copied from class: Query
        Prints a query to a string, with field assumed to be the default field and omitted.
        Specified by:
        toString in class Query
      • toDot

        public String toDot()
        Returns the dot (graphviz) representation of this automaton. This is extremely useful for visualizing the automaton.
      • rewrite

        public Query rewrite(IndexReader reader)
                      throws IOException
        Description copied from class: Query
        Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
        Overrides:
        rewrite in class Query
        Throws:
        IOException