From 862b9ea4a7d9d38f7b59982f78c715669d89dd20 Mon Sep 17 00:00:00 2001 From: Christoph Goller Date: Tue, 14 Sep 2004 13:46:25 +0000 Subject: [PATCH] QueryParser can now handle minimumSimilarity parameter of FuzzyQuery git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150507 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/queryParser/TestQueryParser.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/src/test/org/apache/lucene/queryParser/TestQueryParser.java b/src/test/org/apache/lucene/queryParser/TestQueryParser.java index 55222b8d128..f6d794a6187 100644 --- a/src/test/org/apache/lucene/queryParser/TestQueryParser.java +++ b/src/test/org/apache/lucene/queryParser/TestQueryParser.java @@ -89,7 +89,7 @@ public class TestQueryParser extends TestCase { super(f, a); } - protected Query getFuzzyQuery(String field, String termStr) throws ParseException { + protected Query getFuzzyQuery(String field, String termStr, float minSimilarity) throws ParseException { throw new ParseException("Fuzzy queries not allowed"); } @@ -235,15 +235,17 @@ public class TestQueryParser extends TestCase { public void testWildcard() throws Exception { assertQueryEquals("term*", null, "term*"); assertQueryEquals("term*^2", null, "term*^2.0"); - assertQueryEquals("term~", null, "term~"); - assertQueryEquals("term~^2", null, "term^2.0~"); - assertQueryEquals("term^2~", null, "term^2.0~"); + assertQueryEquals("term~", null, "term~0.5"); + assertQueryEquals("term~0.7", null, "term~0.7"); + assertQueryEquals("term~^2", null, "term^2.0~0.5"); + assertQueryEquals("term^2~", null, "term^2.0~0.5"); assertQueryEquals("term*germ", null, "term*germ"); assertQueryEquals("term*germ^3", null, "term*germ^3.0"); assertTrue(getQuery("term*", null) instanceof PrefixQuery); assertTrue(getQuery("term*^2", null) instanceof PrefixQuery); assertTrue(getQuery("term~", null) instanceof FuzzyQuery); + assertTrue(getQuery("term~0.7", null) instanceof FuzzyQuery); assertTrue(getQuery("term*germ", null) instanceof WildcardQuery); /* Tests to see that wild card terms are (or are not) properly @@ -364,10 +366,10 @@ public class TestQueryParser extends TestCase { assertQueryEquals("a:b\\\\?c", a, "a:b\\?c"); - assertQueryEquals("a:b\\-c~", a, "a:b-c~"); - assertQueryEquals("a:b\\+c~", a, "a:b+c~"); - assertQueryEquals("a:b\\:c~", a, "a:b:c~"); - assertQueryEquals("a:b\\\\c~", a, "a:b\\c~"); + assertQueryEquals("a:b\\-c~", a, "a:b-c~0.5"); + assertQueryEquals("a:b\\+c~", a, "a:b+c~0.5"); + assertQueryEquals("a:b\\:c~", a, "a:b:c~0.5"); + assertQueryEquals("a:b\\\\c~", a, "a:b\\c~0.5"); assertQueryEquals("[ a\\- TO a\\+ ]", null, "[a- TO a+]"); assertQueryEquals("[ a\\: TO a\\~ ]", null, "[a: TO a~]");