From: Wolfgang M. M. <wol...@us...> - 2004-03-25 13:01:37
|
Update of /cvsroot/exist/eXist-1.0/src/org/exist/storage In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24347/src/org/exist/storage Modified Files: DBBroker.java TextSearchEngine.java NativeBroker.java Log Message: * NativeBroker.findElementsByTagName now directly checks child, descendant and descendant-or-self relations by calling a passed instance of class NodeSelector. This saves one processing step when processing path expressions and reduces memory consumption. * clear the XQueryContext before putting a compiled expression into cache. Index: NativeBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/NativeBroker.java,v retrieving revision 1.59 retrieving revision 1.60 diff -C2 -d -r1.59 -r1.60 *** NativeBroker.java 5 Mar 2004 11:15:28 -0000 1.59 --- NativeBroker.java 25 Mar 2004 12:50:50 -0000 1.60 *************** *** 85,88 **** --- 85,89 ---- import org.exist.util.VariableByteOutputStream; import org.exist.xquery.Constants; + import org.exist.xquery.NodeSelector; import org.exist.xquery.XQueryContext; import org.w3c.dom.Document; *************** *** 370,376 **** *@param docs Description of the Parameter *@param tagName Description of the Parameter ! *@return Description of the Return Value */ ! public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname) { // final long start = System.currentTimeMillis(); final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256); --- 371,378 ---- *@param docs Description of the Parameter *@param tagName Description of the Parameter ! *@return */ ! public NodeSet findElementsByTagName(byte type, DocumentSet docs, QName qname, ! NodeSelector selector) { // final long start = System.currentTimeMillis(); final ExtArrayNodeSet result = new ExtArrayNodeSet(docs.getLength(), 256); *************** *** 379,389 **** int len; short collectionId; ! long gid; // , address; VariableByteInputStream is; ElementValue ref; - // byte[] data; InputStream dis = null; short sym, nsSym; Collection collection; final short nodeType = (type == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE : Node.ELEMENT_NODE); --- 381,391 ---- int len; short collectionId; ! long gid; VariableByteInputStream is; ElementValue ref; InputStream dis = null; short sym, nsSym; Collection collection; + NodeProxy p; final short nodeType = (type == ElementValue.ATTRIBUTE ? Node.ATTRIBUTE_NODE : Node.ELEMENT_NODE); *************** *** 430,436 **** for (int k = 0; k < len; k++) { gid = gid + is.readLong(); ! result.add( ! new NodeProxy(doc, gid, nodeType, StorageAddress.read(is)), ! len); } } --- 432,438 ---- for (int k = 0; k < len; k++) { gid = gid + is.readLong(); ! p = new NodeProxy(doc, gid, nodeType, StorageAddress.read(is)); ! if(selector == null || selector.match(p)) ! result.add(p, len); } } *************** *** 440,444 **** } } ! result.sort(); // LOG.debug( // "found " --- 442,446 ---- } } ! // result.sort(); // LOG.debug( // "found " *************** *** 501,505 **** public NodeSet getAttributesByName(DocumentSet docs, QName qname) { qname.setLocalName(qname.getLocalName()); ! NodeSet result = findElementsByTagName(ElementValue.ATTRIBUTE, docs, qname); return result; } --- 503,507 ---- public NodeSet getAttributesByName(DocumentSet docs, QName qname) { qname.setLocalName(qname.getLocalName()); ! NodeSet result = findElementsByTagName(ElementValue.ATTRIBUTE, docs, qname, null); return result; } Index: TextSearchEngine.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/TextSearchEngine.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** TextSearchEngine.java 1 Mar 2004 13:20:35 -0000 1.7 --- TextSearchEngine.java 25 Mar 2004 12:50:50 -0000 1.8 *************** *** 21,38 **** package org.exist.storage; - import org.apache.log4j.Category; import java.io.FileNotFoundException; import java.io.IOException; import java.io.StreamTokenizer; - import java.io.FileReader; - import java.util.TreeSet; import java.util.Observable; ! import org.exist.util.*; ! import org.exist.collections.*; ! import org.exist.dom.*; import org.exist.security.PermissionDeniedException; import org.exist.security.User; - import org.exist.storage.analysis.Tokenizer; import org.exist.storage.analysis.SimpleTokenizer; /** --- 21,46 ---- package org.exist.storage; import java.io.FileNotFoundException; + import java.io.FileReader; import java.io.IOException; import java.io.StreamTokenizer; import java.util.Observable; ! import java.util.TreeSet; ! ! import org.apache.log4j.Logger; ! import org.exist.collections.Collection; ! import org.exist.dom.AttrImpl; ! import org.exist.dom.DocumentImpl; ! import org.exist.dom.DocumentSet; ! import org.exist.dom.NodeImpl; ! import org.exist.dom.NodeSet; ! import org.exist.dom.TextImpl; import org.exist.security.PermissionDeniedException; import org.exist.security.User; import org.exist.storage.analysis.SimpleTokenizer; + import org.exist.storage.analysis.Tokenizer; + import org.exist.util.Configuration; + import org.exist.util.Occurrences; + import org.exist.util.PorterStemmer; /** *************** *** 46,51 **** public abstract class TextSearchEngine extends Observable { ! protected final static Category LOG = ! Category.getInstance(TextSearchEngine.class.getName()); protected TreeSet stoplist = new TreeSet(); --- 54,59 ---- public abstract class TextSearchEngine extends Observable { ! protected final static Logger LOG = ! Logger.getLogger(TextSearchEngine.class); protected TreeSet stoplist = new TreeSet(); Index: DBBroker.java =================================================================== RCS file: /cvsroot/exist/eXist-1.0/src/org/exist/storage/DBBroker.java,v retrieving revision 1.22 retrieving revision 1.23 diff -C2 -d -r1.22 -r1.23 *** DBBroker.java 8 Mar 2004 11:21:21 -0000 1.22 --- DBBroker.java 25 Mar 2004 12:50:50 -0000 1.23 *************** *** 49,52 **** --- 49,53 ---- import org.exist.util.VariableByteInputStream; import org.exist.util.VariableByteOutputStream; + import org.exist.xquery.NodeSelector; import org.w3c.dom.Document; import org.w3c.dom.Node; *************** *** 169,173 **** byte type, DocumentSet docs, ! QName qname); /** flush all data that has not been written before. */ --- 170,175 ---- byte type, DocumentSet docs, ! QName qname, ! NodeSelector selector); /** flush all data that has not been written before. */ |