From: Wolfgang M. M. <wol...@us...> - 2004-03-25 12:49:41
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21955/src/org/exist/xquery/functions Modified Files: ExtNear.java Log Message: Wildcards only worked for the last keyword; no match if first keyword appears several times within searching distance. Index: ExtNear.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtNear.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** ExtNear.java 29 Jan 2004 15:06:41 -0000 1.1 --- ExtNear.java 25 Mar 2004 12:38:53 -0000 1.2 *************** *** 32,36 **** import org.apache.oro.text.regex.Perl5Matcher; import org.exist.EXistException; - import org.exist.dom.DocumentSet; import org.exist.dom.ExtArrayNodeSet; import org.exist.dom.NodeProxy; --- 32,35 ---- *************** *** 41,46 **** import org.exist.xquery.Constants; import org.exist.xquery.Expression; - import org.exist.xquery.XQueryContext; import org.exist.xquery.XPathException; import org.exist.xquery.value.IntegerValue; import org.exist.xquery.value.Sequence; --- 40,45 ---- import org.exist.xquery.Constants; import org.exist.xquery.Expression; import org.exist.xquery.XPathException; + import org.exist.xquery.XQueryContext; import org.exist.xquery.value.IntegerValue; import org.exist.xquery.value.Sequence; *************** *** 82,86 **** boolean hasWildcards = false; for(int i = 0; i < terms.length; i++) { ! hasWildcards = NativeTextEngine.containsWildcards(terms[i]); } --- 81,85 ---- boolean hasWildcards = false; for(int i = 0; i < terms.length; i++) { ! hasWildcards |= NativeTextEngine.containsWildcards(terms[i]); } *************** *** 118,124 **** term = terms[j]; distance = -1; ! continue; ! } ! if (word.equalsIgnoreCase(term)) { distance = 0; j++; --- 117,122 ---- term = terms[j]; distance = -1; ! ! } else if (word.equalsIgnoreCase(term)) { distance = 0; j++; *************** *** 132,138 **** } else if (j > 0 && word.equalsIgnoreCase(terms[0])) { // first search term found: start again ! j = 0; term = terms[j]; ! distance = -1; continue; } else if (-1 < distance) --- 130,136 ---- } else if (j > 0 && word.equalsIgnoreCase(terms[0])) { // first search term found: start again ! j = 1; term = terms[j]; ! distance = 0 ; continue; } else if (-1 < distance) *************** *** 202,208 **** } else if (j > 0 && matcher.matches(word, patterns[0])) { // first search term found: start again ! j = 0; term = patterns[j]; ! distance = -1; continue; } else if (-1 < distance) --- 200,206 ---- } else if (j > 0 && matcher.matches(word, patterns[0])) { // first search term found: start again ! j = 1; term = patterns[j]; ! distance = 0; continue; } else if (-1 < distance) |