Return-Path: Mailing-List: contact lucene-dev-help@jakarta.apache.org; run by ezmlm Delivered-To: mailing list lucene-dev@jakarta.apache.org Received: (qmail 42311 invoked from network); 5 Sep 2003 10:16:45 -0000 Received: from unknown (HELO moutng.kundenserver.de) (212.227.126.184) by daedalus.apache.org with SMTP; 5 Sep 2003 10:16:45 -0000 Received: from [212.227.126.155] (helo=mrelayng.kundenserver.de) by moutng.kundenserver.de with esmtp (Exim 3.35 #1) id 19vCe8-0002f4-00 for lucene-dev@jakarta.apache.org; Fri, 05 Sep 2003 11:12:48 +0200 Received: from [62.245.209.4] (helo=detego-software.de) by mrelayng.kundenserver.de with asmtp (TLSv1:RC4-MD5:128) (Exim 3.35 #1) id 19vCe6-000495-00 for lucene-dev@jakarta.apache.org; Fri, 05 Sep 2003 11:12:46 +0200 Message-ID: <3F5853F8.60300@detego-software.de> Date: Fri, 05 Sep 2003 11:14:32 +0200 From: Christoph Goller User-Agent: Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.2.1) Gecko/20021204 X-Accept-Language: de, en-us, en, de-at MIME-Version: 1.0 To: lucene-dev@jakarta.apache.org Subject: PATCH: FuzzyTermEnum X-Enigmail-Version: 0.71.0.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: multipart/mixed; boundary="------------010806030505000806000403" X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --------------010806030505000806000403 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit Though it does not have any serious consequences, I think that the distance matrix in FuzzyTermEnum is initialized a little bit strange. I changed it to what the author had probably in mind. (patch attached). Christoph -- ***************************************************************** * Dr. Christoph Goller Tel.: +49 89 203 45734 * * Detego Software GmbH Mobile: +49 179 1128469 * * Keuslinstr. 13 Fax.: +49 721 151516176 * * 80798 M�nchen, Germany Email: goller@detego-software.de * ***************************************************************** --------------010806030505000806000403 Content-Type: text/plain; name="FuzzyTermEnumPatch.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="FuzzyTermEnumPatch.txt" Index: FuzzyTermEnum.java =================================================================== RCS file: /home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/search/FuzzyTermEnum.java,v retrieving revision 1.3 diff -u -r1.3 FuzzyTermEnum.java --- FuzzyTermEnum.java 29 Jan 2003 17:18:54 -0000 1.3 +++ FuzzyTermEnum.java 5 Sep 2003 08:36:55 -0000 @@ -124,7 +124,7 @@ * This static array saves us from the time required to create a new array * everytime editDistance is called. */ - private int e[][] = new int[0][0]; + private int e[][] = new int[1][1]; /** Levenshtein distance also known as edit distance is a measure of similiarity @@ -137,7 +137,7 @@ */ private final int editDistance(String s, String t, int n, int m) { if (e.length <= n || e[0].length <= m) { - e = new int[Math.max(e.length, n+1)][Math.max(e.length, m+1)]; + e = new int[Math.max(e.length, n+1)][Math.max(e[0].length, m+1)]; } int d[][] = e; // matrix int i; // iterates through s --------------010806030505000806000403--