docName = p.doc.getCollection().getName() + '/' + p.doc.getFileName(); doctype = p.doc.getDoctype();
docName = p.getDocument().getCollection().getName() + '/' + p.getDocument().getFileName(); doctype = p.getDocument().getDoctype();
	public Hashtable summary(User user, String xpath) throws Exception {		long startTime = System.currentTimeMillis();		DBBroker broker = null;		try {			broker = brokerPool.get(user);			Sequence resultSeq = doQuery(user, broker, xpath, null, null, null);			if (resultSeq == null)				return new Hashtable();			NodeList resultSet = (NodeList) resultSeq;			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.getCollection().getName() + '/' + 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);				}			}			Hashtable result = new Hashtable();			result.put("queryTime", new Integer((int) (System					.currentTimeMillis() - startTime)));			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);		}	}