public class NodeFuzzyQuery extends MultiNodeTermQuery
This query uses MultiTermQuery.TopTermsScoringBooleanQueryRewrite
as default. So terms will be collected and scored according to their
edit distance. Only the top terms are used for building the NodeBooleanQuery.
It is not recommended to change the rewrite mode for fuzzy queries.
Code taken from FuzzyQuery and adapted for SIREn.
MultiNodeTermQuery.RewriteMethod| Modifier and Type | Field and Description |
|---|---|
static int |
defaultMaxEdits |
static int |
defaultMaxExpansions |
static int |
defaultPrefixLength |
static boolean |
defaultTranspositions |
CONSTANT_SCORE_AUTO_REWRITE_DEFAULT, CONSTANT_SCORE_BOOLEAN_QUERY_REWRITE, CONSTANT_SCORE_FILTER_REWRITE, field, rewriteMethod, SCORING_BOOLEAN_QUERY_REWRITEdatatypeancestor, levelConstraint, lowerBound, upperBound| Constructor and Description |
|---|
NodeFuzzyQuery(org.apache.lucene.index.Term term)
Calls
SirenFuzzyQuery(term, 0.5f, 0, Integer.MAX_VALUE). |
NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits)
Calls
SirenFuzzyQuery(term, minimumSimilarity, 0, Integer.MAX_VALUE). |
NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits,
int prefixLength)
Calls
SirenFuzzyQuery(term, minimumSimilarity, prefixLength, Integer.MAX_VALUE). |
NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits,
int prefixLength,
int maxExpansions,
boolean transpositions)
Create a new SirenFuzzyQuery that will match terms with a similarity
of at least
minimumSimilarity to term. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
int |
getMaxEdits() |
int |
getPrefixLength()
Returns the non-fuzzy prefix length.
|
org.apache.lucene.index.Term |
getTerm()
Returns the pattern term.
|
protected org.apache.lucene.index.TermsEnum |
getTermsEnum(org.apache.lucene.index.Terms terms,
org.apache.lucene.util.AttributeSource atts)
Construct the enumeration to be used, expanding the
pattern term.
|
int |
hashCode() |
String |
toString(String field) |
getField, getRewriteMethod, getTermsEnum, rewrite, setRewriteMethodsetDatatype, wrapToStringWithDatatypegetDocsNodesAndPositionsEnum, getLevelConstraint, getNodeConstraint, setAncestorPointer, setLevelConstraint, setNodeConstraint, setNodeConstraintpublic static final int defaultMaxEdits
public static final int defaultPrefixLength
public static final int defaultMaxExpansions
public static final boolean defaultTranspositions
public NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits,
int prefixLength,
int maxExpansions,
boolean transpositions)
minimumSimilarity to term.
If a prefixLength > 0 is specified, a common prefix
of that length is also required.term - the term to search formaxEdits - must be >= 0 and <= LevenshteinAutomata.MAXIMUM_SUPPORTED_DISTANCE.prefixLength - length of common (non-fuzzy) prefixmaxExpansions - the maximum number of terms to match. If this number is
greater than NodeBooleanQuery.getMaxClauseCount() when the query is rewritten,
then the maxClauseCount will be used instead.transpositions - true if transpositions should be treated as a primitive
edit operation. If this is false, comparisons will implement the classic
Levenshtein algorithm.public NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits,
int prefixLength)
SirenFuzzyQuery(term, minimumSimilarity, prefixLength, Integer.MAX_VALUE).public NodeFuzzyQuery(org.apache.lucene.index.Term term,
int maxEdits)
SirenFuzzyQuery(term, minimumSimilarity, 0, Integer.MAX_VALUE).public NodeFuzzyQuery(org.apache.lucene.index.Term term)
SirenFuzzyQuery(term, 0.5f, 0, Integer.MAX_VALUE).public int getMaxEdits()
public int getPrefixLength()
protected org.apache.lucene.index.TermsEnum getTermsEnum(org.apache.lucene.index.Terms terms,
org.apache.lucene.util.AttributeSource atts)
throws IOException
MultiNodeTermQueryTermsEnum.EMPTY if no
terms match). The TermsEnum must already be
positioned to the first matching term.
The given AttributeSource is passed by the MultiNodeTermQuery.RewriteMethod to
provide attributes, the rewrite method uses to inform about e.g. maximum competitive boosts.
This is currently only used by TopNodeTermsRewritegetTermsEnum in class MultiNodeTermQueryIOExceptionpublic org.apache.lucene.index.Term getTerm()
public String toString(String field)
toString in class org.apache.lucene.search.Querypublic int hashCode()
hashCode in class MultiNodeTermQuerypublic boolean equals(Object obj)
equals in class MultiNodeTermQueryCopyright © 2014. All rights reserved.