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.TopTermsBlendedFreqScoringRewrite, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
automaton, automatonIsBinary, compiled, term
CONSTANT_SCORE_BOOLEAN_REWRITE, CONSTANT_SCORE_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_REWRITE
NULL_ACCOUNTABLE
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 syntax_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 . |
RegexpQuery(Term term,
int syntax_flags,
int match_flags,
AutomatonProvider provider,
int maxDeterminizedStates)
Constructs a query for terms matching
term . |
RegexpQuery(Term term,
int syntax_flags,
int match_flags,
int maxDeterminizedStates)
Constructs a query for terms matching
term . |
Modifier and Type | Method and Description |
---|---|
Term |
getRegexp()
Returns the regexp of this query wrapped in a Term.
|
String |
toString(String field)
Prints a user-readable version of this query.
|
equals, getAutomaton, getTermsEnum, hashCode, isAutomatonBinary, ramBytesUsed, visit
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethod
classHash, createWeight, sameClassAs, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getChildResources
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 syntax 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 syntax_flags, int match_flags, int maxDeterminizedStates)
term
.term
- regular expression.syntax_flags
- optional RegExp syntax features from RegExp
automaton for the regexp can result in. Set higher to allow more complex
queries and lower to prevent memory exhaustion.match_flags
- boolean 'or' of match behavior options such as case insensitivitymaxDeterminizedStates
- maximum number of states that compiling thepublic RegexpQuery(Term term, int syntax_flags, AutomatonProvider provider, int maxDeterminizedStates)
term
.term
- regular expression.syntax_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 RegexpQuery(Term term, int syntax_flags, int match_flags, AutomatonProvider provider, int maxDeterminizedStates)
term
.term
- regular expression.syntax_flags
- optional RegExp features from RegExp
match_flags
- boolean 'or' of match behavior options such as case insensitivityprovider
- 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 Term getRegexp()
public String toString(String field)
toString
in class AutomatonQuery
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.