LUCENE-5768: hunspell condition checks with character classes were buggy

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1603007 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2014-06-16 21:56:05 +00:00
parent e7f81b4d6c
commit dd32343ee2
5 changed files with 43 additions and 1 deletions

View File

@ -330,6 +330,9 @@ Bug fixes
* LUCENE-5747: Project-specific settings for the eclipse development
environment will prevent automatic code reformatting. (Shawn Heisey)
* LUCENE-5768: Hunspell condition checks containing character classes
were buggy. (Clinton Gormley, Robert Muir)
Test Framework
* LUCENE-5622: Fail tests if they print over the given limit of bytes to

View File

@ -420,7 +420,7 @@ public class Dictionary {
String condition = ruleArgs.length > 4 ? ruleArgs[4] : ".";
// at least the gascon affix file has this issue
if (condition.startsWith("[") && !condition.endsWith("]")) {
if (condition.startsWith("[") && condition.indexOf(']') == -1) {
condition = condition + "]";
}
// "dash hasn't got special meaning" (we must escape it)

View File

@ -0,0 +1,32 @@
package org.apache.lucene.analysis.hunspell;
import org.junit.BeforeClass;
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
public class TestCondition2 extends StemmerTestBase {
@BeforeClass
public static void beforeClass() throws Exception {
init("condition2.aff", "condition2.dic");
}
public void testStemming() {
assertStemsTo("monopolies", "monopoly");
}
}

View File

@ -0,0 +1,5 @@
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwzESIANRTOLCDUGMPHBYFVKWZ'
SFX S Y 1
SFX S y ies [^aeiou]y

View File

@ -0,0 +1,2 @@
1
monopoly/S