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
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 |
---|---|
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 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 Term getRegexp()
public String toString(String field)
toString
in class AutomatonQuery
Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.