Package org.apache.lucene.search
Class AutomatonQuery
- java.lang.Object
-
- org.apache.lucene.search.Query
-
- org.apache.lucene.search.MultiTermQuery
-
- org.apache.lucene.search.AutomatonQuery
-
- All Implemented Interfaces:
java.lang.Cloneable
- Direct Known Subclasses:
RegexpQuery
,WildcardQuery
public class AutomatonQuery extends MultiTermQuery
AQuery
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 withRegexpQuery
or from the standard Lucene wildcard syntax withWildcardQuery
.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.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.search.MultiTermQuery
MultiTermQuery.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.search.MultiTermQuery
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, SCORING_BOOLEAN_QUERY_REWRITE
-
-
Constructor Summary
Constructors Constructor Description AutomatonQuery(Term term, Automaton automaton)
Create a new AutomatonQuery from anAutomaton
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
Automaton
getAutomaton()
Returns the automaton used to create this queryint
hashCode()
java.lang.String
toString(java.lang.String field)
Prints a query to a string, withfield
assumed to be the default field and omitted.-
Methods inherited from class org.apache.lucene.search.MultiTermQuery
getField, getRewriteMethod, rewrite, setRewriteMethod
-
Methods inherited from class org.apache.lucene.search.Query
clone, createWeight, extractTerms, getBoost, setBoost, toString
-
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classMultiTermQuery
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classMultiTermQuery
-
toString
public java.lang.String toString(java.lang.String field)
Description copied from class:Query
Prints a query to a string, withfield
assumed to be the default field and omitted.
-
getAutomaton
public Automaton getAutomaton()
Returns the automaton used to create this query
-
-