Index: /trunk/gsdl/src/recpt/z3950proto.cpp
===================================================================
--- /trunk/gsdl/src/recpt/z3950proto.cpp	(revision 1899)
+++ /trunk/gsdl/src/recpt/z3950proto.cpp	(revision 1900)
@@ -351,4 +351,5 @@
     // go through options
     text_t opt_term;            // the term(s) that the user entered 
+    int opt_querytype=0;        // 1=>ranked (or), 2=>boolean (and)
     text_t opt_fields;          // which fields to search on
     int opt_start=1, opt_end=20; // default values
@@ -357,26 +358,26 @@
     OptionValue_tarray::iterator ov_end=request.filterOptions.end();
     while (ov_here != ov_end) {
-      // cerr << "OV pair: `" << ov_here->name.getcstr() << "'=`" 
-      //      << ov_here->value.getcstr() << "'\n";
-      if (ov_here->name=="Term") 
-	{
-	  opt_term=ov_here->value;
-	} else if (ov_here->name=="Index") 
-	  {
-	    opt_fields=ov_here->value;
-	  } else if (ov_here->name=="StartResults") 
-	    {
-	      opt_start=ov_here->value.getint();
-	    } else if (ov_here->name=="EndResults") 
-	      {
-		opt_end=ov_here->value.getint();
-	      } else if (ov_here->name=="Maxdocs") 
-		{
-		  maxdocs=ov_here->value.getint();
-		} 
+      if (ov_here->name=="Term") {
+	opt_term=ov_here->value;
+      } else if (ov_here->name=="QueryType") {
+	if (ov_here->value=="ranked") opt_querytype=1;
+	else if (ov_here->value=="boolean") opt_querytype=2;
+	else { /* error - shouldn't happen */
+	  /* currently unhandled */
+	}
+      } else if (ov_here->name=="Index") {
+	opt_fields=ov_here->value;
+      } else if (ov_here->name=="StartResults") {
+	opt_start=ov_here->value.getint();
+      } else if (ov_here->name=="EndResults") {
+	opt_end=ov_here->value.getint(); 
+      } else if (ov_here->name=="Maxdocs") {
+	maxdocs=ov_here->value.getint();
+      } 
       ov_here++;
     }
     err=noError;
     text_tarray *titles=(*zserver)->getrecordTitles(opt_term,
+						    opt_querytype,
 						    opt_fields,
 						    opt_start, // first to get
@@ -422,5 +423,5 @@
     } // end of if (... & FRtermFreq)
     
-  } // end of if (... & FROID)
+  } // end of if (... == "QueryFilter")
   else {
     // this wasn't a query action
@@ -443,5 +444,7 @@
       response.docInfo.push_back(*docInfo); 
     }
-  }
+  } // end of not a query action
+
+
 
   // Fill in metadata for each response.docInfo (if wanted)
@@ -450,26 +453,12 @@
     // should check err returned here....
 
-    // get the Query out of the filterOptions.
-    text_t query="";
-    text_t field="";
-    OptionValue_tarray::iterator opt_here=request.filterOptions.begin();
-    OptionValue_tarray::iterator opt_end=request.filterOptions.end();
-    while (opt_here!=opt_end) {
-      if (opt_here->name=="Query") {
-	query=opt_here->value;
-	if (field!="") break; // break from loop if we've got both
-      } else if (opt_here->name=="Index") {
-	field=opt_here->value;
-	if (query!="") break; // break from loop if we've got both
-      }
-      opt_here++;
-    }
-
     if (!request.fields.empty()) {
+      // currently, this is only true for NullFilter when getting the "Title"
+      // for a documentaction.
+
       // loop on each document being returned
       ResultDocInfo_tarray::iterator docs_here=response.docInfo.begin();
       ResultDocInfo_tarray::iterator docs_end=response.docInfo.end();
       while (docs_here!=docs_end) {
-	
 	// loop on all the metadata fields in request.fields (type text_tset)
 	text_tset::iterator fields_here=request.fields.begin();
@@ -489,10 +478,27 @@
 	    i=request.docSet[0].getint();
 	    text_t doctext="unneeded";
-	    (*zserver)->getfullrecord(query, field, i, doctitle, doctext, err);
+	    /* following variables aren't used, as our query result has been
+	       cached in z3950server.cpp (but really we shouldn't know that
+	       here...) But for the NullFilter, we don't get given these
+	       again in the request, so for now we'll take advantage of this.*/
+
+	    int querytype=0; text_t field="";
+
+	    // get the Query out of the filterOptions. (we need get the Title)
+	    text_t query="";
+	    OptionValue_tarray::iterator opthere=request.filterOptions.begin();
+	    OptionValue_tarray::iterator opt_end=request.filterOptions.end();
+	    while (opthere!=opt_end) {
+	      if (opthere->name=="Query") {
+		query=opthere->value;
+		break;
+	      }
+	      opthere++;
+	    }
+	    (*zserver)->getfullrecord(query, querytype, field, i, doctitle, doctext, err);
 	    // check err value!
 	    docs_here->metadata["Title"].values.push_back(doctitle);	    
 	  } else {
 	    docs_here->metadata[*fields_here].values.push_back("");
-	    /////// cerr << " (not found)";
 	  }
 	  fields_here++;
@@ -501,5 +507,5 @@
       } // end of outer while loop
     } // end of if (!request.fields.empty())
-
+    
     else { // request.fields empty: return all metadata for about page or query
       // we'll only put it in the first docInfo.
@@ -571,6 +577,7 @@
   text_t query; // this should not be needed, as we have already connected to 
   // get the  title....
-  text_t field; // ditto...
-  (*zserver)->getfullrecord(query,field,request.OID.getint(),
+  int querytype; //ditto...
+  text_t field;  // ditto...
+  (*zserver)->getfullrecord(query,querytype,field,request.OID.getint(),
 			    title,doctext,err);
   // check return value of above? (false=>not connected) 
Index: /trunk/gsdl/src/recpt/z3950server.cpp
===================================================================
--- /trunk/gsdl/src/recpt/z3950server.cpp	(revision 1899)
+++ /trunk/gsdl/src/recpt/z3950server.cpp	(revision 1900)
@@ -107,4 +107,5 @@
 
 void z3950_server::parseQuery(const text_t &query, 
+			      const int querytype,
 			      const text_t &fields,
 			      text_t &parsed_query) {
@@ -127,4 +128,5 @@
   bool inword=false;
   int num_terms=0;
+
 
   for (int i=0;i<strlength;i++) {
@@ -161,14 +163,21 @@
     parsed_query+="1016 ";
 
+  // querytype=1 => ranked/or,  =2 => boolean/and
   // append "@and" for each term after the first
-  for (int i=1;i<num_terms;i++)
-    parsed_query+="@and ";
-  // append the actual query
-  parsed_query+=ptr;
-
+  {
+    char and_str[]="@and ";
+    char or_str[]="@or ";
+    char *q_type;
+    if (querytype==1) q_type=or_str; else q_type=and_str;
+    for (int i=1;i<num_terms;i++)
+      parsed_query+=q_type;
+    // append the actual query
+    parsed_query+=ptr;
+  }
   delete ptr;
 }
 
 text_tarray *z3950_server::getrecordTitles(const text_t &query, 
+					   const int querytype,
 					   const text_t &fields,
 					   int first, int count,
@@ -210,5 +219,5 @@
 
   text_t expanded_query="";
-  parseQuery(query,fields,expanded_query);
+  parseQuery(query,querytype,fields,expanded_query);
 
   char* query_str=expanded_query.getcstr();
@@ -253,5 +262,7 @@
 }
 
-bool z3950_server::getfullrecord(const text_t &query, const text_t &fields,
+bool z3950_server::getfullrecord(const text_t &query, 
+				 const int querytype,
+				 const text_t &fields,
 				 const int ID, 
 				 text_t &rettitle, 
@@ -279,5 +290,5 @@
 
     text_t expanded_query="";
-    parseQuery(query,fields,expanded_query);
+    parseQuery(query,querytype,fields,expanded_query);
 
     char* query_str=expanded_query.getcstr();
Index: /trunk/gsdl/src/recpt/z3950server.h
===================================================================
--- /trunk/gsdl/src/recpt/z3950server.h	(revision 1899)
+++ /trunk/gsdl/src/recpt/z3950server.h	(revision 1900)
@@ -58,4 +58,5 @@
   text_t &getzAbout(); // gets any name, id, MOTD, etc from server.
   text_tarray *getrecordTitles(const text_t &query,
+			       const int querytype,
 			       const text_t &fields,
 			       const int first, const int count,
@@ -63,9 +64,11 @@
   /* only get one record at a time? (Eventually we could buffer them, but
      for now... */
-  bool getfullrecord(const text_t &query, const text_t &fields,
+  bool getfullrecord(const text_t &query, const int querytype,
+		     const text_t &fields,
 		     const int ID, text_t &rettitle, 
 		     text_t &rettext,comerror_t &err);
  private:
-  void parseQuery(const text_t &query, const text_t &fields, 
+  void parseQuery(const text_t &query, const int querytype, 
+		  const text_t &fields, 
 		  text_t &parsed_query);
 };
