From: Wolfgang M. M. <wol...@us...> - 2004-08-13 21:28:56
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16322/src/org/exist/xquery/functions Modified Files: ExtFulltext.java Log Message: Allow arrays to be passed to Java methods from XQuery. Index: ExtFulltext.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/xquery/functions/ExtFulltext.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ExtFulltext.java 28 May 2004 10:54:09 -0000 1.5 --- ExtFulltext.java 13 Aug 2004 21:28:47 -0000 1.6 *************** *** 205,227 **** if (terms == null) throw new RuntimeException("no search terms"); ! NodeSet hits[] = new NodeSet[terms.length]; ! for (int k = 0; k < terms.length; k++) { ! hits[k] = ! context.getBroker().getTextEngine().getNodesContaining( ! context, contextSet.getDocumentSet(), contextSet, terms[k]); } ! NodeSet result = hits[0]; ! if(result != null) { ! for(int k = 1; k < hits.length; k++) { ! if(hits[k] != null) ! result = (type == Constants.FULLTEXT_AND ? ! result.deepIntersection(hits[k]) : result.union(hits[k])); ! } ! return result; ! } else ! return NodeSet.EMPTY_SET; } --- 205,229 ---- if (terms == null) throw new RuntimeException("no search terms"); ! if(terms.length == 0) ! return NodeSet.EMPTY_SET; ! NodeSet hits[] = new NodeSet[terms.length]; ! for (int k = 0; k < terms.length; k++) { ! hits[k] = ! context.getBroker().getTextEngine().getNodesContaining( ! context, contextSet.getDocumentSet(), contextSet, terms[k]); + } + NodeSet result = hits[0]; + if(result != null) { + for(int k = 1; k < hits.length; k++) { + if(hits[k] != null) + result = (type == Constants.FULLTEXT_AND ? + result.deepIntersection(hits[k]) : result.union(hits[k])); } ! return result; ! } else ! return NodeSet.EMPTY_SET; } |