mirror of https://github.com/apache/lucene.git
add public methods to query the minimum similarity and the prefix length
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150513 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
74cadb2dcf
commit
45ac0c2628
|
@ -40,8 +40,8 @@ public final class FuzzyQuery extends MultiTermQuery {
|
|||
* between the query term and the matching terms. For example, for a
|
||||
* <code>minimumSimilarity</code> of <code>0.5</code> 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 <code>length(term)*0.5</code>.
|
||||
* @param prefixLength length of common prefix.
|
||||
* between both terms is less than <code>length(term)*0.5</code>
|
||||
* @param prefixLength length of common (non-fuzzy) prefix
|
||||
* @throws IllegalArgumentException if minimumSimilarity is > 1 or < 0
|
||||
* or if prefixLength < 0 or > <code>term.text().length()</code>.
|
||||
*/
|
||||
|
@ -74,7 +74,24 @@ public final class FuzzyQuery extends MultiTermQuery {
|
|||
public FuzzyQuery(Term term) {
|
||||
this(term, defaultMinSimilarity, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minimum similarity that is required for this query to match.
|
||||
* @return float value between 0.0 and 1.0
|
||||
*/
|
||||
public float getMinSimilarity() {
|
||||
return minimumSimilarity;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
public int getPrefixLength() {
|
||||
return prefixLength;
|
||||
}
|
||||
|
||||
protected FilteredTermEnum getEnum(IndexReader reader) throws IOException {
|
||||
return new FuzzyTermEnum(reader, getTerm(), minimumSimilarity, prefixLength);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue