|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.lucene.search.Query
org.apache.lucene.search.MultiTermQuery
org.apache.lucene.search.FuzzyQuery
public final class FuzzyQuery
Implements the fuzzy search query. The similiarity measurement is based on the Levenshtein (edit distance) algorithm.
Field Summary | |
---|---|
static float |
defaultMinSimilarity
|
Constructor Summary | |
---|---|
FuzzyQuery(Term term)
Calls FuzzyQuery(term, 0.5f, 0) . |
|
FuzzyQuery(Term term,
float minimumSimilarity)
Calls FuzzyQuery(term, minimumSimilarity, 0) . |
|
FuzzyQuery(Term term,
float minimumSimilarity,
int prefixLength)
Create a new FuzzyQuery that will match terms with a similarity of at least minimumSimilarity to term . |
Method Summary | |
---|---|
protected FilteredTermEnum |
getEnum(IndexReader reader)
Construct the enumeration to be used, expanding the pattern term. |
float |
getMinSimilarity()
Returns the minimum similarity that is required for this query to match. |
int |
getPrefixLength()
Returns the prefix length, i.e. |
java.lang.String |
toString(java.lang.String field)
Prints a user-readable version of this query. |
Methods inherited from class org.apache.lucene.search.MultiTermQuery |
---|
combine, getTerm, rewrite |
Methods inherited from class org.apache.lucene.search.Query |
---|
clone, createWeight, getBoost, getSimilarity, mergeBooleanQueries, setBoost, toString, weight |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final float defaultMinSimilarity
Constructor Detail |
---|
public FuzzyQuery(Term term, float minimumSimilarity, int prefixLength) throws java.lang.IllegalArgumentException
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
java.lang.IllegalArgumentException
- if minimumSimilarity is > 1 or < 0
or if prefixLength < 0 or > term.text().length()
.public FuzzyQuery(Term term, float minimumSimilarity) throws java.lang.IllegalArgumentException
FuzzyQuery(term, minimumSimilarity, 0)
.
java.lang.IllegalArgumentException
public FuzzyQuery(Term term)
FuzzyQuery(term, 0.5f, 0)
.
Method Detail |
---|
public float getMinSimilarity()
public int getPrefixLength()
protected FilteredTermEnum getEnum(IndexReader reader) throws java.io.IOException
MultiTermQuery
getEnum
in class MultiTermQuery
java.io.IOException
public java.lang.String toString(java.lang.String field)
MultiTermQuery
toString
in class MultiTermQuery
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |