public class RegexpQuery extends AutomatonQuery
org.apache.lucene.util.automaton
package.
AutomatonQuery
for more details.
The supported syntax is documented in the RegExp
class.
Note this might be different than other regular expression implementations.
For some alternatives with different syntax, look under the sandbox.
Note this query can be slow, as it needs to iterate over many terms. In order
to prevent extremely slow RegexpQueries, a Regexp term should not start with
the expression .*
RegExp
MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
automaton, compiled, term
CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITE
Constructor and Description |
---|
RegexpQuery(Term term)
Constructs a query for terms matching
term . |
RegexpQuery(Term term,
int flags)
Constructs a query for terms matching
term . |
RegexpQuery(Term term,
int flags,
AutomatonProvider provider,
int maxDeterminizedStates)
Constructs a query for terms matching
term . |
RegexpQuery(Term term,
int flags,
int maxDeterminizedStates)
Constructs a query for terms matching
term . |
Modifier and Type | Method and Description |
---|---|
String |
toString(String field)
Prints a user-readable version of this query.
|
equals, getAutomaton, getTermsEnum, hashCode
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod
clone, createWeight, extractTerms, getBoost, setBoost, toString
public RegexpQuery(Term term)
term
.
By default, all regular expression features are enabled.
term
- regular expression.public RegexpQuery(Term term, int flags)
term
.term
- regular expression.flags
- optional RegExp features from RegExp
public RegexpQuery(Term term, int flags, int maxDeterminizedStates)
term
.term
- regular expression.flags
- optional RegExp features from RegExp
maxDeterminizedStates
- maximum number of states that compiling the
automaton for the regexp can result in. Set higher to allow more complex
queries and lower to prevent memory exhaustion.public RegexpQuery(Term term, int flags, AutomatonProvider provider, int maxDeterminizedStates)
term
.term
- regular expression.flags
- optional RegExp features from RegExp
provider
- custom AutomatonProvider for named automatamaxDeterminizedStates
- maximum number of states that compiling the
automaton for the regexp can result in. Set higher to allow more complex
queries and lower to prevent memory exhaustion.public String toString(String field)
toString
in class AutomatonQuery
Copyright © 2000-2015 Apache Software Foundation. All Rights Reserved.