Index: src/edu/ucsb/nceas/metacat/QuerySpecification.java
===================================================================
--- src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 177)
+++ src/edu/ucsb/nceas/metacat/QuerySpecification.java	(revision 178)
@@ -157,7 +157,7 @@
     elementStack.push(currentNode); 
     if (currentNode.getTagName().equals("querygroup")) {
       QueryGroup currentGroup = new QueryGroup(
-                                currentNode.getAttribute("booleantype"));
+                                currentNode.getAttribute("operator"));
       if (query == null) {
         query = currentGroup;
       } else {
@@ -229,9 +229,8 @@
     // This determines the returned results
     self.append("SELECT docid,docname,doctype,doctitle ");
     self.append("FROM xml_documents WHERE docid IN (");
-    self.append("SELECT DISTINCT docid FROM xml_nodes WHERE \n");
 
-    // This determines the WHERE conditions
+    // This determines the documents that meet the query conditions
     self.append(query.printSQL());
 
     self.append(") ");
@@ -267,17 +266,17 @@
 
   /** a utility class that represents a group of terms in a query */
   private class QueryGroup {
-    private String booleantype = null; // indicates how query terms are combined
-    private Vector children = null;    // the list of query terms and groups
+    private String operator = null;  // indicates how query terms are combined
+    private Vector children = null;  // the list of query terms and groups
 
     /** 
      * construct a new QueryGroup 
      *
-     * @param booleantype the boolean conector used to connect query terms 
+     * @param operator the boolean conector used to connect query terms 
      *                    in this query group
      */
-    public QueryGroup(String booleantype) {
-      this.booleantype = booleantype;
+    public QueryGroup(String operator) {
+      this.operator = operator;
       children = new Vector();
     }
 
@@ -321,7 +320,7 @@
         if (first) {
           first = false;
         } else {
-          self.append(" " + booleantype + " ");
+          self.append(" " + operator + " ");
         }
         if (qobject instanceof QueryGroup) {
           QueryGroup qg = (QueryGroup)qobject;
@@ -344,7 +343,7 @@
     public String toString() {
       StringBuffer self = new StringBuffer();
 
-      self.append("  (Query group booleantype=" + booleantype + "\n");
+      self.append("  (Query group operator=" + operator + "\n");
       Enumeration en= getChildren();
       while (en.hasMoreElements()) {
         Object qobject = en.nextElement();
@@ -444,7 +443,7 @@
         searchvalue = casevalue;
       }
 
-      self.append("(");
+      self.append("SELECT DISTINCT docid FROM xml_nodes WHERE \n");
 
       if (pathexpr != null) {
         self.append(nodedataterm + " LIKE " + "'" + searchvalue + "' ");
@@ -455,8 +454,6 @@
         self.append(nodedataterm + " LIKE " + "'" + searchvalue + "' ");
       }
 
-      self.append(") \n");
-
       return self.toString();
     }
 
Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 177)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 178)
@@ -126,9 +126,9 @@
   /** 
    * routine to search the elements and attributes looking to match query
    *
-   * @param queryspec the xml serialization of the query (@see pathquery.dtd)
+   * @param xmlquery the xml serialization of the query (@see pathquery.dtd)
    */
-  public Hashtable findDocuments(Reader queryspec) {
+  public Hashtable findDocuments(Reader xmlquery) {
       Hashtable	 docListResult = new Hashtable();
       PreparedStatement pstmt;
       String docid = null;
@@ -139,8 +139,9 @@
 
       try {
         // Get the XML query and covert it into a SQL statment
-        QuerySpecification qspec = new QuerySpecification(queryspec, 
+        QuerySpecification qspec = new QuerySpecification(xmlquery, 
                                    parserName);
+        System.out.println(qspec.printSQL());
         pstmt = conn.prepareStatement( qspec.printSQL() );
 
         // Execute the SQL query using the JDBC connection
