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.ConstantScoreAutoRewrite, MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
automaton, compiled, term
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, 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)
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, 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, AutomatonProvider provider)
term
.term
- regular expression.flags
- optional RegExp features from RegExp
provider
- custom AutomatonProvider for named automatapublic String toString(String field)
toString
in class AutomatonQuery
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.