java.lang.Object | |||
↳ | org.apache.lucene.search.Query | ||
↳ | org.apache.lucene.search.MultiTermQuery | ||
↳ | org.apache.lucene.search.FuzzyQuery |
Implements the fuzzy search query. The similarity measurement is based on the Levenshtein (edit distance) algorithm. Warning: this query is not very scalable with its default prefix length of 0 - in this case, *every* term will be enumerated and cause an edit score calculation.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
float | defaultMinSimilarity | ||||||||||
int | defaultPrefixLength |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
term |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.search.MultiTermQuery
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Create a new FuzzyQuery that will match terms with a similarity
of at least
minimumSimilarity to term . | |||||||||||
Calls
FuzzyQuery(term, 0.5f, 0) . |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Returns the minimum similarity that is required for this query to match.
| |||||||||||
Returns the non-fuzzy prefix length.
| |||||||||||
Returns the pattern term.
| |||||||||||
Expert: called to re-write queries into primitive queries.
| |||||||||||
Sets the rewrite method to be used when executing the
query.
| |||||||||||
Prints a query to a string, with
field assumed to be the
default field and omitted. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Construct the enumeration to be used, expanding the pattern term.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
org.apache.lucene.search.MultiTermQuery
| |||||||||||
From class
org.apache.lucene.search.Query
| |||||||||||
From class
java.lang.Object
|
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 for |
---|---|
minimumSimilarity | 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 |
IllegalArgumentException | if minimumSimilarity is >= 1 or < 0 or if prefixLength < 0 |
---|
Returns the minimum similarity that is required for this query to match.
Returns the non-fuzzy prefix length. This is 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.
Expert: called to re-write queries into primitive queries. For example, a PrefixQuery will be rewritten into a BooleanQuery that consists of TermQuerys.
IOException |
---|
Sets the rewrite method to be used when executing the
query. You can use one of the four core methods, or
implement your own subclass of MultiTermQuery.RewriteMethod
.
Prints a query to a string, with field
assumed to be the
default field and omitted.
The representation used is one that is supposed to be readable
by QueryParser
. However,
there are the following limitations:
Construct the enumeration to be used, expanding the pattern term.
IOException |
---|