mirror of https://github.com/apache/lucene.git
Throw ParseException instead of IllegalArgumentException
in case of illegal value for FuzzyQuery minimum similarity parameter. git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150511 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a6fad246dd
commit
99d5aeee4a
|
@ -706,6 +706,9 @@ public class QueryParser implements QueryParserConstants {
|
|||
try {
|
||||
fms = Float.valueOf(fuzzySlop.image.substring(1)).floatValue();
|
||||
} catch (Exception ignored) { }
|
||||
if(fms < 0.0f || fms > 1.0f){
|
||||
{if (true) throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");}
|
||||
}
|
||||
q = getFuzzyQuery(field, termImage, fms);
|
||||
} else {
|
||||
q = getFieldQuery(field, termImage);
|
||||
|
|
|
@ -684,6 +684,9 @@ Query Term(String field) : {
|
|||
try {
|
||||
fms = Float.valueOf(fuzzySlop.image.substring(1)).floatValue();
|
||||
} catch (Exception ignored) { }
|
||||
if(fms < 0.0f || fms > 1.0f){
|
||||
throw new ParseException("Minimum similarity for a FuzzyQuery has to be between 0.0f and 1.0f !");
|
||||
}
|
||||
q = getFuzzyQuery(field, termImage, fms);
|
||||
} else {
|
||||
q = getFieldQuery(field, termImage);
|
||||
|
|
Loading…
Reference in New Issue