public class WildcardQuery extends AutomatonQuery
*
, which
matches any character sequence (including the empty one), and ?
,
which matches any single character. '\' is the escape character.
Note this query can be slow, as it
needs to iterate over many terms. In order to prevent extremely slow WildcardQueries,
a Wildcard term should not start with the wildcard *
This query uses the MultiTermQuery.CONSTANT_SCORE_REWRITE
rewrite method.
AutomatonQuery
MultiTermQuery.RewriteMethod, MultiTermQuery.TopTermsBlendedFreqScoringRewrite, MultiTermQuery.TopTermsBoostOnlyBooleanQueryRewrite, MultiTermQuery.TopTermsScoringBooleanQueryRewrite
Modifier and Type | Field and Description |
---|---|
static char |
WILDCARD_CHAR
Char equality with support for wildcards
|
static char |
WILDCARD_ESCAPE
Escape character
|
static char |
WILDCARD_STRING
String equality with support for wildcards
|
automaton, automatonIsBinary, compiled, term
CONSTANT_SCORE_BOOLEAN_REWRITE, CONSTANT_SCORE_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_REWRITE
NULL_ACCOUNTABLE
Constructor and Description |
---|
WildcardQuery(Term term)
Constructs a query for terms matching
term . |
WildcardQuery(Term term,
int determinizeWorkLimit)
Constructs a query for terms matching
term . |
Modifier and Type | Method and Description |
---|---|
Term |
getTerm()
Returns the pattern term.
|
static Automaton |
toAutomaton(Term wildcardquery)
Convert Lucene wildcard syntax into an automaton.
|
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 static final char WILDCARD_STRING
public static final char WILDCARD_CHAR
public static final char WILDCARD_ESCAPE
public WildcardQuery(Term term)
term
.public WildcardQuery(Term term, int determinizeWorkLimit)
term
.determinizeWorkLimit
- maximum effort to spend while compiling the automaton from this
wildcard. Set higher to allow more complex queries and lower to prevent memory exhaustion.
Use Operations.DEFAULT_DETERMINIZE_WORK_LIMIT
as a decent default if you don't
otherwise know what to specify.public static Automaton toAutomaton(Term wildcardquery)
public Term getTerm()
public String toString(String field)
toString
in class AutomatonQuery
Copyright © 2000-2021 Apache Software Foundation. All Rights Reserved.