dnaber 2004/09/15 12:44:01 Modified: src/java/org/apache/lucene/search FuzzyQuery.java Log: add public methods to query the minimum similarity and the prefix length Revision Changes Path 1.7 +19 -2 jakarta-lucene/src/java/org/apache/lucene/search/FuzzyQuery.java Index: FuzzyQuery.java =================================================================== RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/search/FuzzyQuery.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- FuzzyQuery.java 14 Sep 2004 13:45:15 -0000 1.6 +++ FuzzyQuery.java 15 Sep 2004 19:44:01 -0000 1.7 @@ -40,8 +40,8 @@ * 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 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); }
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]