org.apache.lucene.search
Class FuzzyQuery
- Cloneable, java.io.Serializable
public final class FuzzyQuery
Implements the fuzzy search query. The similiarity measurement
is based on the Levenshtein (edit distance) algorithm.
clone , combine , createWeight , getBoost , getSimilarity , mergeBooleanQueries , rewrite , setBoost , toString , toString , weight |
defaultMinSimilarity
public static final float defaultMinSimilarity
FuzzyQuery
public FuzzyQuery(Term term)
FuzzyQuery
public FuzzyQuery(Term term,
float minimumSimilarity)
throws IllegalArgumentException
FuzzyQuery
public FuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength)
throws IllegalArgumentException
Create a new FuzzyQuery that will match terms with a similarity
of at least minimumSimilarity
to term
.
If a prefixLength
> 0 is specified, a common prefix
of that length is also required.
term
- the term to search forminimumSimilarity
- a value between 0 and 1 to set the required similarity
between the query term and the matching terms. For example, for a
minimumSimilarity
of 0.5
a term of the same length
as the query term is considered similar to the query term if the edit distance
between both terms is less than length(term)*0.5
prefixLength
- length of common (non-fuzzy) prefix
getMinSimilarity
public float getMinSimilarity()
Returns the minimum similarity that is required for this query to match.
- float value between 0.0 and 1.0
getPrefixLength
public int getPrefixLength()
Returns the prefix length, i.e. the number of characters at the start
of a term that must be identical (not fuzzy) to the query term if the query
is to match that term.
toString
public String toString(String field)
Prints a user-readable version of this query.
- toString in interface MultiTermQuery
Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.