public Hashtable summary(User user, int resultId) throws EXistException {
public Hashtable summary(User user, String xpath) throws Exception {
	public Hashtable summary(User user, int resultId) throws EXistException {		long startTime = System.currentTimeMillis();		QueryResult qr = (QueryResult) connectionPool.resultSets.get(resultId);		if (qr == null)			throw new EXistException("result set unknown or timed out");		qr.timestamp = System.currentTimeMillis();		Hashtable result = new Hashtable();		result.put("queryTime", new Integer((int) qr.queryTime));		if (qr.result == null) {			result.put("hits", new Integer(0));			return result;		}		DBBroker broker = brokerPool.get(user);		try {			NodeList resultSet = (NodeList) qr.result;			HashMap map = new HashMap();			HashMap doctypes = new HashMap();			NodeProxy p;			String docName;			DocumentType doctype;			NodeCount counter;			DoctypeCount doctypeCounter;			for (Iterator i = ((NodeSet) resultSet).iterator(); i.hasNext(); ) {				p = (NodeProxy) i.next();				docName = p.doc.getFileName();				doctype = p.doc.getDoctype();				if (map.containsKey(docName)) {					counter = (NodeCount) map.get(docName);					counter.inc();				} else {					counter = new NodeCount(p.doc);					map.put(docName, counter);				}				if (doctype == null)					continue;				if (doctypes.containsKey(doctype.getName())) {					doctypeCounter = (DoctypeCount) doctypes.get(doctype							.getName());					doctypeCounter.inc();				} else {					doctypeCounter = new DoctypeCount(doctype);					doctypes.put(doctype.getName(), doctypeCounter);				}			}			result.put("hits", new Integer(resultSet.getLength()));			Vector documents = new Vector();			Vector hitsByDoc;			for (Iterator i = map.values().iterator(); i.hasNext(); ) {				counter = (NodeCount) i.next();				hitsByDoc = new Vector();				hitsByDoc.addElement(counter.doc.getFileName());				hitsByDoc.addElement(new Integer(counter.doc.getDocId()));				hitsByDoc.addElement(new Integer(counter.count));				documents.addElement(hitsByDoc);			}			result.put("documents", documents);			Vector dtypes = new Vector();			Vector hitsByType;			DoctypeCount docTemp;			for (Iterator i = doctypes.values().iterator(); i.hasNext(); ) {				docTemp = (DoctypeCount) i.next();				hitsByType = new Vector();				hitsByType.addElement(docTemp.doctype.getName());				hitsByType.addElement(new Integer(docTemp.count));				dtypes.addElement(hitsByType);			}			result.put("doctypes", dtypes);			return result;		} finally {			brokerPool.release(broker);		}	}