Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 2090)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 2091)
@@ -345,7 +345,18 @@
                                       DBConnection dbconn, boolean useXMLIndex )
                                       throws Exception
     {
-      int offset = 800;
+      int offset = 1;
+      // this is a hack for offset
+      if (out == null)
+      {
+        // for html page, we put everything into one page
+        offset = 500000;
+      }
+      else
+      {
+          offset =
+              (new Integer(MetaCatUtil.getOption("resultsetsize"))).intValue();
+      }
       int count = 0;
       int index = 0;
       Hashtable docListResult = new Hashtable();
@@ -396,7 +407,7 @@
         // if there are returndocs to match, backtracking can be performed
         // otherwise, just return the document that was hit
         Vector returndocVec = qspec.getReturnDocList();
-        if (returndocVec.size() != 0 && !returndocVec.contains(doctype)
+         if (returndocVec.size() != 0 && !returndocVec.contains(doctype)
                         && !qspec.isPercentageSearch())
         {
            MetaCatUtil.debugMessage("Back tracing now...", 20);
@@ -458,7 +469,7 @@
                 if (docid_org == null)
                 {
                    MetaCatUtil.debugMessage("Docid_org was null.", 40);
-                   continue;
+                   //continue;
                 }
                 docid = docid_org.trim();
                 docname = xmldoc.getDocname();
@@ -492,8 +503,8 @@
                 // Store the document id and the root node id
                 docListResult.put(docid, (String) document.toString());
                 count++;
-                index++;
 
+
                 // Get the next package document linked to our hit
                 hasBtRows = btrs.next();
               }//while
@@ -528,8 +539,8 @@
               // Store the document id and the root node id
               docListResult.put(docid, (String) document.toString());
               count++;
-              index++;
 
+
         }//else
         // when doclist reached the offset number, send out doc list and empty
         // the hash table
@@ -557,7 +568,7 @@
      double docListTime = System.currentTimeMillis() / 1000;
      MetaCatUtil.debugMessage("prepare docid list time: "
                     + (docListTime - queryExecuteTime), 30);
-     MetaCatUtil.debugMessage("total docid is ===== "+index, 30);
+
      return resultsetBuffer;
     }//findReturnDoclist
 
@@ -573,8 +584,6 @@
                                        DBConnection dbconn, boolean useXMLIndex)
                                        throws Exception
    {
-
-     int index =0;
      //add return field
      partOfDoclist = addRetrunfield(partOfDoclist, qspec, user, groups,
                                         dbconn, useXMLIndex );
@@ -594,15 +603,10 @@
            if (out != null)
            {
              out.println(xmlElement);
-             index++;
            }
-           else
-           {
-             index++;
-           }
            resultset.append(xmlElement);
       }//while
-      MetaCatUtil.debugMessage("total package number is ======= = "+ index, 20);
+
       return resultset;
    }
 
@@ -1043,8 +1047,10 @@
         Object nextelement;
         //add the xml headers
         query.append("<?xml version=\"1.0\"?>\n");
-        query.append("<pathquery version=\"1.0\">\n");
+        query.append("<pathquery version=\"1.2\">\n");
 
+
+
         if (params.containsKey("meta_file_id")) {
             query.append("<meta_file_id>");
             query.append(((String[]) params.get("meta_file_id"))[0]);
@@ -1155,6 +1161,7 @@
             ignoredParams.add("owner");
             ignoredParams.add("site");
             ignoredParams.add("operator");
+            ignoredParams.add("sessionid");
 
             // Also ignore parameters listed in the properties file
             // so that they can be passed through to stylesheets
