Index: /trunk/gsdl/src/recpt/queryaction.cpp
===================================================================
--- /trunk/gsdl/src/recpt/queryaction.cpp	(revision 8028)
+++ /trunk/gsdl/src/recpt/queryaction.cpp	(revision 8029)
@@ -63,5 +63,5 @@
   argsinfo.addarginfo (NULL, arg_ainfo);
   
-   // "ct" - 0 = mg, 1 = mgpp
+   // "ct" - 0 = mg, 1 = mgpp, 2=lucene
   arg_ainfo.shortname = "ct";
   arg_ainfo.longname = "collection type";
@@ -506,5 +506,5 @@
   // check ct argument
   int arg_ct = args.getintarg("ct");
-  if (arg_ct !=0 && arg_ct !=1) {
+  if (arg_ct <0 && arg_ct >2) {
     logout << "Warning: \"ct\" argument out of range (" << arg_ct << ")\n";
     cgiarginfo *ctinfo = argsinfo.getarginfo ("ct");
@@ -708,5 +708,5 @@
     if (it != end) set_option_macro ("cq2", args["cq2"], true,false, (*it).second, disp);
 
-    if (args["ct"] == "1") { // mgpp collections
+    if ((args["ct"] == "1") || (args["ct"] == "2"))  { // mgpp/lucene collections
       // _gselection_ (Level) 
       it = response.filterOptions.find("Level");
@@ -789,8 +789,8 @@
   // _advformlist_
 
-  if (args["ct"]=="0" || args["qto"]=="1" || (args["qto"]=="3" && args["qt"] == "0") ) // mg, or mgpp with plain only, or mgpp with both, but set to plain
+  if (args["ct"]=="0" || args["qto"]=="1" || (args["qto"]=="3" && args["qt"] == "0") ) // mg, or mgpp/lucene with plain only, or mgpp with both, but set to plain
     return; // dont need these macros
 
-    // mgpp & form query only needs the macros defined
+  // mgpp & form query only needs the macros defined
   text_t form = "";
   int argfqn = args.getintarg("fqn");
@@ -1398,8 +1398,13 @@
     format_querystring (formattedstring, args.getintarg("b"), segment);
     if (args["ct"]=="1") { // mgpp - we need to add in the field info
-      format_field_info(formattedstring, args["fqf"]);
-    }
+      mgpp_format_field_info(formattedstring, args["fqf"]);
+    }
+    else if (args["ct"]=="2") { // lucene - we need to add in the field info
+      lucene_format_field_info(formattedstring, args["fqf"]);
+    }
+
     add_dates(formattedstring, args.getintarg("ds"), args.getintarg("de"),
-	      args.getintarg("dsbc"), args.getintarg("debc"));
+	      args.getintarg("dsbc"), args.getintarg("debc"),
+	      args.getintarg("ct"));
     args["q"] = formattedstring;
   }
Index: /trunk/gsdl/src/recpt/querytools.cpp
===================================================================
--- /trunk/gsdl/src/recpt/querytools.cpp	(revision 8028)
+++ /trunk/gsdl/src/recpt/querytools.cpp	(revision 8029)
@@ -198,5 +198,5 @@
 	
 void add_dates(text_t &querystring, int startdate, int enddate, 
-	       int startbc, int endbc)
+	       int startbc, int endbc, int ct)
 {
   if(startdate)
@@ -232,13 +232,10 @@
        if(!enddate)
 	 {
-	   querystring.appendcstr(" [");
-	   if(startdate<0)
-	     {
-	       querystring.appendcstr("bc");
-	       querystring.appendint((startdate*-1));
-	     }
-	   else 
-	     querystring.appendint(startdate);
-	   querystring.appendcstr("]:CV");
+	   if (ct==1) {
+	     mgpp_adddateelem(querystring,startdate);
+	   }
+	   else { // lucene
+	     lucene_adddateelem(querystring,startdate);
+	   }
 	 }
        else{
@@ -247,16 +244,12 @@
 	 while(nextdate<=enddate)
 	   {
-	     if(nextdate!=0)
-	       {
-		 querystring.appendcstr(" [");
-		 if(nextdate<0)
-		   {
-		     querystring.appendcstr("bc");
-		     querystring.appendint((nextdate*-1));
-		   }
-		 else 
-		   querystring.appendint(nextdate);
-		 querystring.appendcstr("]:CV");
+	     if(nextdate!=0) {
+	       if (ct==1) {
+		 mgpp_adddateelem(querystring,nextdate);
 	       }
+	       else { // lucene
+		 lucene_adddateelem(querystring,nextdate);
+	       }
+	     }
 	     nextdate++;
 	   }
@@ -320,11 +313,20 @@
 // some query form parsing functions for use with mgpp
 
-void parse_reg_query_form(text_t &querystring, cgiargsclass &args){
-
+void parse_reg_query_form(text_t &querystring, cgiargsclass &args)
+{
   querystring.clear();
+
+  const int ct = args.getintarg("ct");
+  int argt = args.getintarg("t");// t=0 -and, t=1 - or
+
   text_t combine;
-  int argt = args.getintarg("t");// t=0 -and, t=1 - or
-  if (argt == 0) combine = "&";
-  else combine = "|";
+  if (ct==1) {
+    if (argt == 0) combine = "&";
+    else combine = "|";
+  }
+  else { // lucene
+    if (argt == 0) combine = "AND";
+    else combine = "OR";
+  }
   
   text_t field = args["fqf"];
@@ -338,7 +340,13 @@
   splitchar(value.begin(), value.end(), ',', values);
 
+
   for (int i=0; i< values.size(); i++) {
     if (!values[i].empty()) {
-      addqueryelem(querystring, fields[i], values[i], combine);
+      if (ct == 1) {
+	mgpp_addqueryelem(querystring, fields[i], values[i], combine);
+      }
+      else { // lucene
+	lucene_addqueryelem(querystring, fields[i], values[i], combine);
+      }
     }
   }
@@ -350,5 +358,13 @@
 
   querystring.clear();
-  text_t combine = "&";
+
+  const int ct = args.getintarg("ct");
+  text_t combine;
+  if (ct==1) {
+    combine = "&";
+  }
+  else { // lucene
+    combine = "AND";
+  }
 
   text_t field = args["fqf"];
@@ -380,10 +396,17 @@
     if (!values[i].empty()) {
       if (i!=0) {
-	if (combs[i-1]=="and") combine = "&";
-	else if (combs[i-1]=="or")combine = "|";
-	else if (combs[i-1]=="not")combine = "!";
+	if (ct==1) {
+	  if (combs[i-1]=="and") combine = "&";
+	  else if (combs[i-1]=="or")combine = "|";
+	  else if (combs[i-1]=="not")combine = "!";
+	}
+	else { // lucene
+	  if (combs[i-1]=="and") combine = "AND";
+	  else if (combs[i-1]=="or")combine = "OR";
+	  else if (combs[i-1]=="not")combine = "NOT";
+	}
       }
       text_t term = addstemcase(values[i], stems[i], folds[i]);
-      addqueryelem(querystring, fields[i], term, combine);
+      mgpp_addqueryelem(querystring, fields[i], term, combine);
     }
     
@@ -446,8 +469,35 @@
 
 
-void addqueryelem(text_t &querystring, text_t &tag, 
+void mgpp_adddateelem(text_t& querystring, const int date)
+{
+  querystring.appendcstr(" [");
+  if(date<0) {
+      querystring.appendcstr("bc");
+      querystring.appendint((date*-1));
+  }
+  else {
+    querystring.appendint(date);
+  }
+  querystring.appendcstr("]:CV");
+}
+
+void lucene_adddateelem(text_t& querystring, const int date)
+{
+  querystring.appendcstr(" CV:(");
+  if(date<0) {
+      querystring.appendcstr("bc");
+      querystring.appendint((date*-1));
+  }
+  else {
+    querystring.appendint(date);
+  }
+  querystring.appendcstr(")");
+}
+
+
+void mgpp_addqueryelem(text_t &querystring, text_t &tag, 
 		  text_t &query, text_t &combine) {
   if (!querystring.empty()) { // have to put and/or
-    querystring += " "+combine + " ";
+    querystring += " " + combine + " ";
  
   }
@@ -459,4 +509,18 @@
   }
 
+}
+
+void lucene_addqueryelem(text_t &querystring, text_t &tag, 
+		  text_t &query, text_t &combine) {
+  if (!querystring.empty()) { // have to put and/or
+    querystring += " " + combine + " ";
+ 
+  }
+  if (tag=="ZZ" || tag=="") { // just add onto querystring
+       querystring +=  query;
+  }
+  else {
+    querystring += tag+":("+query+")";
+  }
 }
 
@@ -544,5 +608,5 @@
 
 
-void format_field_info(text_t & querystring, const text_t &tag) {
+void mgpp_format_field_info(text_t & querystring, const text_t &tag) {
 
   if (tag == "ZZ" || tag == "") {
@@ -552,2 +616,11 @@
   querystring = "["+querystring+"]:"+tag;
 }
+
+void lucene_format_field_info(text_t & querystring, const text_t &tag) {
+
+  if (tag == "ZZ" || tag == "") {
+    return; // do nothing
+  }
+
+  querystring = tag+":("+querystring+")";
+}
Index: /trunk/gsdl/src/recpt/querytools.h
===================================================================
--- /trunk/gsdl/src/recpt/querytools.h	(revision 8028)
+++ /trunk/gsdl/src/recpt/querytools.h	(revision 8029)
@@ -43,5 +43,5 @@
 
 void add_dates(text_t &querystring, int startdate, int enddate, 
-	       int startbc, int endbc);
+	       int startbc, int endbc, int ct);
 
 void get_phrases (const text_t &querystring, text_tarray &phrases);
@@ -56,5 +56,10 @@
 void parse_adv_query_form(text_t &formattedstring, cgiargsclass &args);
 
-void addqueryelem(text_t &querystring, text_t &tag, 
+void mgpp_adddateelem(text_t& querystring, const int date);
+void lucene_adddateelem(text_t& querystring, const int date);
+
+void mgpp_addqueryelem(text_t &querystring, text_t &tag, 
+		  text_t &query, text_t &combine);
+void lucene_addqueryelem(text_t &querystring, text_t &tag, 
 		  text_t &query, text_t &combine);
 void addqueryelem_ex(text_t &querystring, const text_t &tag, 
@@ -63,5 +68,6 @@
 text_t addstemcase(const text_t &terms, const text_t &stem, const text_t &fold);
 text_t formatelem(text_t &text);
-void format_field_info(text_t &querystring, const text_t &tag);
+void mgpp_format_field_info(text_t &querystring, const text_t &tag);
+void lucene_format_field_info(text_t &querystring, const text_t &tag);
 
 #endif
