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:  [EMAIL PROTECTED]  *
*****************************************************************
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

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to