Ignore:
Timestamp:
2010-05-06T12:55:03+12:00 (14 years ago)
Author:
davidb
Message:

Changes necessary to support new sql-query action

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/runtime-src/src/recpt/queryaction.cpp

    r20601 r22046  
    3838#include <assert.h>
    3939
    40 void colinfo_t::clear () {
    41   formatlistptr = NULL;
    42   browserptr = NULL;
    43 }
    44 
    45 void QueryResult_t::clear() {
    46   doc.clear();
    47   collection.clear();
    48 }
    49 
    50 queryaction::queryaction () {
    51 
    52   recpt = NULL;
     40
     41queryaction::queryaction ()
     42  : basequeryaction()
     43{
    5344  num_phrases = 0;
    5445
     46  cgiarginfo arg_ainfo;
     47
    5548  // this action uses cgi variable "a"
    56   cgiarginfo arg_ainfo;
    5749  arg_ainfo.shortname = "a";
    5850  arg_ainfo.longname = "action";
     
    136128
    137129
    138   // "q"
    139   arg_ainfo.shortname = "q";
    140   arg_ainfo.longname = "query string";
    141   arg_ainfo.multiplechar = true;
    142   arg_ainfo.defaultstatus = cgiarginfo::weak;
    143   arg_ainfo.argdefault = g_EmptyText;
    144   arg_ainfo.savedarginfo = cgiarginfo::must;
    145   argsinfo.addarginfo (NULL, arg_ainfo);
    146 
    147   // "q2"
    148   arg_ainfo.shortname = "q2";
    149   arg_ainfo.longname = "query string for second query";
    150   arg_ainfo.multiplechar = true;
    151   arg_ainfo.defaultstatus = cgiarginfo::weak;
    152   arg_ainfo.argdefault = g_EmptyText;
    153   arg_ainfo.savedarginfo = cgiarginfo::must;
    154   argsinfo.addarginfo (NULL, arg_ainfo);
    155 
    156   // "cq2" ""=don't combine, "and", "or", "not"
    157   arg_ainfo.shortname = "cq2";
    158   arg_ainfo.longname = "combine queries";
    159   arg_ainfo.multiplechar = true;
    160   arg_ainfo.defaultstatus = cgiarginfo::weak;
    161   arg_ainfo.argdefault = g_EmptyText;
    162   arg_ainfo.savedarginfo = cgiarginfo::must;
    163   argsinfo.addarginfo (NULL, arg_ainfo);
    164 
    165130  // "t" - 1 = ranked 0 = boolean
    166131  arg_ainfo.shortname = "t";
     
    226191  argsinfo.addarginfo (NULL, arg_ainfo);
    227192 
    228   // "m"
    229   arg_ainfo.shortname = "m";
    230   arg_ainfo.longname = "maximum number of documents";
    231   arg_ainfo.multiplechar = true;
    232   arg_ainfo.defaultstatus = cgiarginfo::weak;
    233   arg_ainfo.argdefault = "50";
    234   arg_ainfo.savedarginfo = cgiarginfo::must;
    235   argsinfo.addarginfo (NULL, arg_ainfo);
    236 
    237   // "o"
    238   arg_ainfo.shortname = "o";
    239   arg_ainfo.longname = "hits per page";
    240   arg_ainfo.multiplechar = true;
    241   arg_ainfo.defaultstatus = cgiarginfo::weak;
    242   arg_ainfo.argdefault = "20";
    243   arg_ainfo.savedarginfo = cgiarginfo::must;
    244   argsinfo.addarginfo (NULL, arg_ainfo);
    245 
    246   // "r"
    247   arg_ainfo.shortname = "r";
    248   arg_ainfo.longname = "start results from";
    249   arg_ainfo.multiplechar = true;
    250   arg_ainfo.defaultstatus = cgiarginfo::weak;
    251   arg_ainfo.argdefault = "1";
    252   arg_ainfo.savedarginfo = cgiarginfo::must;
    253   argsinfo.addarginfo (NULL, arg_ainfo);
    254193
    255194  // "ccs"
     
    281220  argsinfo.addarginfo (NULL, arg_ainfo);
    282221
    283   // "hd" history display  - search history only displayed when
    284   // this var set to something other than 0
    285   // this number of records is displayed
    286   arg_ainfo.shortname = "hd";
    287   arg_ainfo.longname = "history display";
    288   arg_ainfo.multiplechar = true;
    289   arg_ainfo.multiplevalue = false;
    290   arg_ainfo.defaultstatus = cgiarginfo::weak;
    291   arg_ainfo.argdefault = "0";
    292   arg_ainfo.savedarginfo = cgiarginfo::must;
    293   argsinfo.addarginfo (NULL, arg_ainfo);
    294        
    295   // "hs"  save - set to 1 in query form, so only save when submit
    296   // query
    297   // 0 = no save 1 = save
    298   arg_ainfo.shortname = "hs";
    299   arg_ainfo.longname = "history save";
    300   arg_ainfo.multiplechar = false;
    301   arg_ainfo.defaultstatus = cgiarginfo::weak;
    302   arg_ainfo.argdefault = "0";
    303   arg_ainfo.savedarginfo = cgiarginfo::mustnot;
    304   argsinfo.addarginfo (NULL, arg_ainfo);
    305222
    306223  // "g" - new arg for granularity, for mgpp collections
     
    376293  argsinfo.addarginfo (NULL, arg_ainfo);
    377294
    378   // "fqn" - number of fields in the query form
    379   arg_ainfo.shortname = "fqn";
    380   arg_ainfo.longname = "form query num fields";
    381   arg_ainfo.multiplechar = true;
    382   arg_ainfo.defaultstatus = cgiarginfo::weak;
    383   arg_ainfo.argdefault = "4";
    384   arg_ainfo.savedarginfo = cgiarginfo::must;
    385   argsinfo.addarginfo (NULL, arg_ainfo);
    386 
    387   // "fqf" - the list of field names in the form query
    388   // - a comma separated list
    389   arg_ainfo.shortname = "fqf";
    390   arg_ainfo.longname = "form query fields";
    391   arg_ainfo.multiplechar = true;
    392   arg_ainfo.defaultstatus = cgiarginfo::weak;
    393   arg_ainfo.argdefault = g_EmptyText;
    394   arg_ainfo.savedarginfo = cgiarginfo::must;
    395   argsinfo.addarginfo (NULL, arg_ainfo);
    396  
    397   // "fqv" - the list of values in the form query
    398   // - a comma separated list
    399   arg_ainfo.shortname = "fqv";
    400   arg_ainfo.longname = "form query values";
    401   arg_ainfo.multiplechar = true;
    402   arg_ainfo.defaultstatus = cgiarginfo::weak;
    403   arg_ainfo.argdefault = g_EmptyText;
    404   arg_ainfo.savedarginfo = cgiarginfo::must;
    405   argsinfo.addarginfo (NULL, arg_ainfo);
    406  
    407295
    408296  // "fqs" - the list of stemming options in the form query
     
    427315  argsinfo.addarginfo (NULL, arg_ainfo);
    428316 
    429   // "fqc" - the list of boolean operators in the form query
    430   // - a comma separated list
    431   arg_ainfo.shortname = "fqc";
    432   arg_ainfo.longname = "form query combines";
    433   arg_ainfo.multiplechar = true;
    434   arg_ainfo.defaultstatus = cgiarginfo::weak;
    435   arg_ainfo.argdefault = g_EmptyText;
    436   arg_ainfo.savedarginfo = cgiarginfo::must;
    437   argsinfo.addarginfo (NULL, arg_ainfo);
    438 
    439   // "fqa" - form query advanced - for "run query"
    440   arg_ainfo.shortname = "fqa";
    441   arg_ainfo.longname = "form query advanced query";
    442   arg_ainfo.multiplechar = false;
    443   arg_ainfo.defaultstatus = cgiarginfo::weak;
    444   arg_ainfo.argdefault = "0";
    445   arg_ainfo.savedarginfo = cgiarginfo::must;
    446   argsinfo.addarginfo (NULL, arg_ainfo);
    447 
    448   // "ifl" - I'm feeling lucky! (Go directly to a matching document)
    449   arg_ainfo.shortname = "ifl";
    450   arg_ainfo.longname = "i'm feeling lucky";
    451   arg_ainfo.multiplechar = false;
    452   arg_ainfo.defaultstatus = cgiarginfo::weak;
    453   arg_ainfo.argdefault = g_EmptyText;
    454   arg_ainfo.savedarginfo = cgiarginfo::mustnot;
    455   argsinfo.addarginfo (NULL, arg_ainfo);
    456 
    457   // "ifln" - I'm feeling lucky number (Go directly to the nth matching document)
    458   arg_ainfo.shortname = "ifln";
    459   arg_ainfo.longname = "i'm feeling lucky number";
    460   arg_ainfo.multiplechar = true;
    461   arg_ainfo.defaultstatus = cgiarginfo::weak;
    462   arg_ainfo.argdefault = "1";
    463   arg_ainfo.savedarginfo = cgiarginfo::mustnot;
    464   argsinfo.addarginfo (NULL, arg_ainfo);
    465 
    466   // "srn" - the next search result
    467   arg_ainfo.shortname = "srn";
    468   arg_ainfo.longname = "the next search result number";
    469   arg_ainfo.multiplechar = true;
    470   arg_ainfo.defaultstatus = cgiarginfo::weak;
    471   arg_ainfo.argdefault = "0";
    472   arg_ainfo.savedarginfo = cgiarginfo::must;
    473   argsinfo.addarginfo (NULL, arg_ainfo);
    474 
    475   // "srp" - the previous search result
    476   arg_ainfo.shortname = "srp";
    477   arg_ainfo.longname = "the previous search result number";
    478   arg_ainfo.multiplechar = true;
    479   arg_ainfo.defaultstatus = cgiarginfo::weak;
    480   arg_ainfo.argdefault = "0";
    481   arg_ainfo.savedarginfo = cgiarginfo::must;
    482   argsinfo.addarginfo (NULL, arg_ainfo);
    483317
    484318  // "sf" - Sort field. Set to field to be used for sorting search reult
    485319  // set (only implemented for lucene collections at present).
    486   arg_ainfo.shortname = "sf";
    487   arg_ainfo.longname = "sort field";
     320  arg_ainfo.shortname = "sqlsf";
     321  arg_ainfo.longname = "sql sort field";
    488322  arg_ainfo.multiplechar = true;
    489323  arg_ainfo.defaultstatus = cgiarginfo::weak;
     
    492326  argsinfo.addarginfo (NULL, arg_ainfo);
    493327
    494   // "fuzziness" controls how closely the search terms must match
    495   // 100 = exact match, 0 = very inexact match (only implemented for Lucene)
    496   arg_ainfo.shortname = "fuzziness";
    497   arg_ainfo.longname = "Lucene fuzziness value";
    498   arg_ainfo.multiplechar = true;
    499   arg_ainfo.defaultstatus = cgiarginfo::weak;
    500   arg_ainfo.argdefault = g_EmptyText;
    501   arg_ainfo.savedarginfo = cgiarginfo::must;
    502   argsinfo.addarginfo (NULL, arg_ainfo);
     328
     329}
     330
     331queryaction::~queryaction ()
     332{
    503333}
    504334
    505335void queryaction::configure (const text_t &key, const text_tarray &cfgline) {
    506   action::configure (key, cfgline);
     336  basequeryaction::configure (key, cfgline);
    507337}
    508338
    509339bool queryaction::init (ostream &logout) {
    510   return action::init (logout);
     340  return basequeryaction::init (logout);
    511341}
    512342
    513343bool queryaction::check_cgiargs (cgiargsinfoclass &argsinfo, cgiargsclass &args,
    514                  recptprotolistclass * /*protos*/, ostream &logout) {
     344                 recptprotolistclass* protos, ostream &logout) {
    515345
    516346  // check t argument
     
    538368  }
    539369
    540   // check m argument
    541   int arg_m = args.getintarg("m");
    542   if (arg_m < -1) {
    543     logout << "Warning: \"m\" argument less than -1 (" << arg_m << ")\n";
    544     cgiarginfo *minfo = argsinfo.getarginfo ("m");
    545     if (minfo != NULL) args["m"] = minfo->argdefault;
    546   }
    547 
    548   // check o argument
    549   int arg_o = args.getintarg("o");
    550   if (arg_o < -1) {
    551     logout << "Warning: \"o\" argument less than -1 (" << arg_o << ")\n";
    552     cgiarginfo *oinfo = argsinfo.getarginfo ("o");
    553     if (oinfo != NULL) args["o"] = oinfo->argdefault;
    554   }
    555 
    556   // check r argument
    557   int arg_r = args.getintarg("r");
    558   if (arg_r < 1) {
    559     logout << "Warning: \"r\" argument less than 1 (" << arg_r << ")\n";
    560     cgiarginfo *rinfo = argsinfo.getarginfo ("r");
    561     if (rinfo != NULL) args["r"] = rinfo->argdefault;
    562   }
    563   //check hd argument
    564   int arg_hd = args.getintarg("hd");
    565   if (arg_hd <0 ) {
    566     logout << "Warning: \"hd\" argument less than 0 (" << arg_hd << ")\n";
    567     cgiarginfo *hdinfo = argsinfo.getarginfo ("hd");
    568     if (hdinfo != NULL) args["hd"] = hdinfo->argdefault;
    569   } 
    570  
    571   //check hs argument
    572   int arg_hs = args.getintarg("hs");
    573   if (arg_hs !=0 && arg_hs !=1) {
    574     logout << "Warning: \"hs\" argument out of range (" << arg_hs << ")\n";
    575     cgiarginfo *hsinfo = argsinfo.getarginfo ("hs");
    576     if (hsinfo != NULL) args["hs"] = hsinfo->argdefault;
    577   }
    578370
    579371  // check ct argument
     
    617409  }
    618410
    619   return true;
    620 }
    621 
    622 void queryaction::get_cgihead_info (cgiargsclass &args, recptprotolistclass * /*protos*/,
    623                     response_t &response, text_t &response_data,
    624                     ostream &/*logout*/) {
    625   // If this is an "I'm feeling lucky" request, we don't know the target location until later
    626   if (!args["ifl"].empty()) {
    627     response = undecided_location;
    628     return;
    629   }
    630 
    631   response = content;
    632   response_data = "text/html";
     411  return basequeryaction::check_cgiargs(argsinfo,args,protos,logout);
     412
    633413}
    634414
    635415void queryaction::define_internal_macros (displayclass &disp, cgiargsclass &args,
    636416                      recptprotolistclass * protos,
    637                       ostream &logout) {
    638 
    639   // define_internal_macros sets the following macros:
    640 
    641   // The following macros are set later (in define_query_macros) as they can't be set until
    642   // the query has been done.
    643   // _quotedquery_   the part of the query string that was quoted for post-processing
    644   // _freqmsg_      the term frequency string
    645 
    646   // _resultline_   the "x documents matched the query" string
    647 
    648   // _prevfirst_    these are used when setting up the links to previous/next
    649   // _prevlast_     pages of results (_thisfirst_ and _thislast_ are used to set
    650   // _nextfirst_    the 'results x-x for query: xxxx' string in the title bar)
    651   // _nextlast_
    652   // _thisfirst_
    653   // _thislast_
    654 
    655  
    656   define_form_macros(disp, args, protos, logout);
    657  
     417                      ostream &logout)
     418{
     419  basequeryaction::define_internal_macros(disp,args,protos,logout);
     420
    658421  define_query_interface(disp, args, protos, logout);
    659 
    660 
    661422}
    662423
     
    693454}
    694455
    695 
    696 // sets the selection box macros _hselection_, _jselection_, _nselection_ _gselection_, fqfselection_
    697 void queryaction::set_option_macro (const text_t &macroname,
    698                     text_t current_value,
    699                     bool display_single,
    700                     bool add_js_update,
    701                     const FilterOption_t &option,
    702                     displayclass &disp) {
    703  
    704   if (option.validValues.empty()) return;
    705   if (option.validValues.size() == 1) {
    706     if (display_single) {
    707       disp.setmacro (macroname + "selection", displayclass::defaultpackage, "_" + option.defaultValue + "_");
    708     }
    709     return;   
    710   }
    711   if (option.validValues.size() < 2) return;
    712  
    713   text_t macrovalue = "<select name=\"" + macroname + "\"";
    714   if (add_js_update) {
    715     macrovalue += " onChange=\"update"+macroname+"();\"";
    716   }
    717   macrovalue += ">\n";
    718  
    719   if (current_value.empty()) current_value = option.defaultValue;
    720  
    721   text_tarray::const_iterator thisvalue = option.validValues.begin();
    722   text_tarray::const_iterator endvalue = option.validValues.end();
    723 
    724   while (thisvalue != endvalue) {
    725     macrovalue += "<option value=\"" + *thisvalue + "\"";
    726     if (*thisvalue == current_value)
    727       macrovalue += " selected";
    728     macrovalue += ">_" + *thisvalue + "_\n";
    729     ++thisvalue;
    730   }
    731   macrovalue += "</select>\n";
    732   disp.setmacro (macroname + "selection", displayclass::defaultpackage, macrovalue);
    733 }
    734456
    735457
     
    832554} // define external macros
    833555 
     556
    834557void queryaction::set_sfselection_macro(text_t current_value,
    835558                       const FilterOption_t &option,
     
    924647  disp.setmacro ("gformselection", displayclass::defaultpackage, macrovalue);
    925648}
     649
    926650void queryaction::define_form_macros (displayclass &disp, cgiargsclass &args,
    927                recptprotolistclass *protos, ostream &logout) {
     651                      recptprotolistclass *protos,
     652                      ostream &logout)
     653{
    928654
    929655  // defines the following macros
     
    952678 
    953679}
    954 
    955 void queryaction::define_history_macros (displayclass &disp, cgiargsclass &args,
    956                      recptprotolistclass *protos, ostream &logout) {
    957 
    958   // defines the following macros
    959   // _searchhistorylist_
    960 
    961   text_t historylist;
    962   int arghd = args.getintarg("hd");
    963   if (arghd == 0) {
    964     historylist="";
    965   }
    966   else {
    967     historylist = "<!-- Search History List -->\n";
    968    
    969     text_t userid = args["z"];
    970     text_tarray entries;
    971     if (get_history_info (userid, entries, dbhome, logout)) {
    972       int count = 1;
    973       text_tarray::iterator here = entries.begin();
    974       text_tarray::iterator end = entries.end();
    975       int numrecords=(int)entries.size();
    976       if (numrecords>arghd) { // only display some of them
    977     numrecords = arghd;
    978       }
    979       historylist += "<form action=\"_gwcgi_\" name=\"HistoryForm\"><table width=\"537\">\n";
    980 
    981       for (int i=0; i<numrecords;++i) {
    982     text_t query;
    983     text_t numdocs;
    984     text_t cgiargs;
    985     text_t userinfo;
    986     text_t escquery;
    987     split_saved_query(entries[i],numdocs,cgiargs);
    988     parse_saved_args(cgiargs, "q", query); // get query string out
    989     decode_cgi_arg(query); // un cgisafe it
    990     escquery = escape_quotes(query); // escape the quotes and newlines
    991     text_t histvalue = "histvalue";
    992     histvalue += i;
    993     disp.setmacro(histvalue, "query", escquery);
    994     format_user_info(cgiargs, userinfo, args, protos, logout);
    995    
    996     historylist += "<tr><td align=\"right\">_imagehistbutton_(";
    997     historylist += i;
    998     historylist += ")</td>\n";
    999     historylist += "<td><table border=\"1\" cellspacing=\"0\" ";
    1000     historylist += "cellpadding=\"0\"><tr><td width=\"365\" align=\"left\">"
    1001       + query
    1002       + "</td></tr></table></td><td width=\"110\" align=\"center\"><small>"
    1003       + numdocs;
    1004     if (numdocs == 1) historylist += " _texthresult_";
    1005     else historylist += " _texthresults_";
    1006     if (!userinfo.empty()) {
    1007       historylist += "<br>( "+userinfo+" )";
    1008     }
    1009     historylist += "</small></td>\n";
    1010       }
    1011       historylist+="</table></form>\n\n";
    1012      
    1013     } // if get history info
    1014     else {
    1015       historylist += "_textnohistory_";
    1016     }
    1017     historylist += "<! ---- end of history list ----->\n";
    1018   } // else display list
    1019   disp.setmacro("searchhistorylist", "query", historylist);
    1020  
    1021 } // define history macros
    1022680
    1023681void queryaction::output_ccp (cgiargsclass &args, recptprotolistclass *protos,
     
    1153811  }
    1154812
    1155 
    1156 
    1157813  if (args["ccs"] == "1") {
    1158814    if (!args["cc"].empty()) {
     
    1177833  return true;
    1178834}
     835
     836
     837
     838// request.filterResultOptions and request.fields (if required) should
     839// be set from the calling code
     840void queryaction::set_queryfilter_options (FilterRequest_t &request,
     841                       const text_t &querystring,
     842                       cgiargsclass &args)
     843{
     844  set_fulltext_queryfilter_options(request,querystring,args);
     845}
     846
     847
     848
     849void queryaction::set_queryfilter_options (FilterRequest_t &request,
     850                       const text_t &querystring1,
     851                       const text_t &querystring2,
     852                       cgiargsclass &args)
     853{
     854  set_fulltext_queryfilter_options(request,querystring1,querystring2,args);
     855}
     856
     857
    1179858
    1180859bool queryaction::search_multiple_collections (cgiargsclass &args, recptprotolistclass *protos,
     
    16881367  } // args["qt"]=1
    16891368  else {
    1690     logout << "ERROR (query_action::get_formatted_query_string): querytype not defined\n";
     1369    logout << "ERROR (queryaction::get_formatted_query_string): querytype not defined\n";
    16911370  }
    16921371}
     
    17001379// and search_multiple_coll
    17011380void queryaction::define_query_macros (cgiargsclass &args, displayclass &disp,
    1702                        int numdocs, isapprox isApprox) {
    1703  
    1704   // set up _resultline_ macro
    1705   text_t resline;
    1706   int maxdocs = args.getintarg("m");
     1381                       int numdocs, isapprox isApprox)
     1382{
     1383  // The following 'if' statatment is placed here to be keep the semantics
     1384  // the same as the version before basequeryaction was introduced
     1385
    17071386  if (num_phrases > 0) isApprox = Exact;
    1708   if (maxdocs == -1) maxdocs = numdocs;
    1709   else if (numdocs > maxdocs) {
    1710     numdocs = maxdocs;
    1711     isApprox = MoreThan;
    1712   }
    1713 
    1714   if (isApprox == Approximate) resline = "_textapprox_";
    1715   else if (isApprox == MoreThan) resline = "_textmorethan_";
    1716  
    1717   if (numdocs == 0) resline = "_textnodocs_";
    1718   else if (numdocs == 1) resline += "_text1doc_";
    1719   else resline += text_t(numdocs) + " _textlotsdocs_";
    1720  
    1721   disp.setmacro("resultline", "query", resline);
    1722 
    1723   int firstdoc = args.getintarg("r");
    1724   int hitsperpage = args.getintarg("o");
    1725   if (hitsperpage == -1) hitsperpage = numdocs;
    1726 
    1727   // set up _thisfirst_ and _thislast_ macros
    1728   disp.setmacro ("thisfirst", "query", firstdoc);
    1729   int thislast = firstdoc + (hitsperpage - 1);
    1730   if (thislast > numdocs) thislast = numdocs;
    1731   disp.setmacro ("thislast", "query", thislast);
    1732 
    1733   // set up _prevfirst_ and _prevlast_ macros
    1734   if (firstdoc > 1) {
    1735     disp.setmacro ("prevlast", "query", firstdoc - 1);
    1736     int prevfirst = firstdoc - hitsperpage;
    1737     if (prevfirst < 1) prevfirst = 1;
    1738     disp.setmacro ("prevfirst", "query", prevfirst);
    1739   }
    1740 
    1741   // set up _nextfirst_ and _nextlast_ macros
    1742   if (thislast < numdocs) {
    1743     disp.setmacro ("nextfirst", "query", thislast + 1);
    1744     int nextlast = thislast + hitsperpage;
    1745     if (nextlast > numdocs) nextlast = numdocs;
    1746     disp.setmacro ("nextlast", "query", nextlast);
    1747   }
    1748 
    1749   // do quoted query here cos we may have added quotes during query pre-processing
     1387
     1388  basequeryaction::define_query_macros(args,disp,numdocs,isApprox);
     1389
    17501390  if (args["ct"]==0) { // mg queries only, not mgpp
    17511391    // get the quoted bits of the query string and set _quotedquery_
     
    17721412}
    17731413
    1774 // define_single_query_macros sets the extra macros for search_single_coll
    1775 // that couldn't be set until the query had been done. Those macros are
    1776 // _freqmsg_ and _stopwordsmsg_
    1777 void queryaction::define_single_query_macros (cgiargsclass &args,
    1778                           displayclass &disp,
    1779                           const FilterResponse_t &response) {
    1780   // set up _freqmsg_ and _stopwordsmsg_ macros
    1781 
    1782   text_t freqmsg = "";
    1783   freqmsg = "_textfreqmsg1_";
    1784   TermInfo_tarray::const_iterator this_term = response.termInfo.begin();
    1785   TermInfo_tarray::const_iterator end_term = response.termInfo.end();
    1786   while (this_term != end_term) {
    1787     freqmsg += (*this_term).term + ": " + (*this_term).freq;
    1788     if ((this_term + 1) != end_term)
    1789       freqmsg += ", ";
    1790     ++this_term;
    1791   }
    1792   disp.setmacro ("freqmsg", "query", freqmsg);
    1793 
    1794   text_tset::const_iterator this_stopword = response.stopwords.begin();
    1795   text_tset::const_iterator end_stopword = response.stopwords.end();
    1796   if (this_stopword != end_stopword) {
    1797     text_t stopwordsmsg = "_textstopwordsmsg_ ";
    1798     while (this_stopword != end_stopword) {
    1799       if (stopwordsmsg != "_textstopwordsmsg_ ") {
    1800     stopwordsmsg += ", ";
    1801       }
    1802       stopwordsmsg += (*this_stopword);
    1803       ++this_stopword;
    1804     }
    1805     disp.setmacro("stopwordsmsg", "query", stopwordsmsg);
    1806   }
    1807 }
    1808 
    18091414// should this change for cross coll search??
    18101415bool queryaction::save_search_history (cgiargsclass &args, int numdocs,
     
    18401445  if (set_history_info(userid, query, dbhome, display)) return true;
    18411446  else return false;
    1842 
    1843 
    1844 }
    1845 
     1447}
     1448
Note: See TracChangeset for help on using the changeset viewer.