Ignore:
Timestamp:
1999-11-02T10:56:12+13:00 (25 years ago)
Author:
sjboddie
Message:

changes for cross-collection searching - still needs work

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/querytools.cpp

    r608 r759  
    2828/*
    2929   $Log$
     30   Revision 1.8  1999/11/01 21:56:12  sjboddie
     31   changes for cross-collection searching - still needs work
     32
    3033   Revision 1.7  1999/09/21 11:32:42  sjboddie
    3134   added Maxdocs queryfilter option which may be -1 for 'all'
     
    5659
    5760
    58 // do_query sets the filter options and makes the protocol call to
    59 // do a query. The results are returned in response.
    60 // request.filterResultOptions and request.fields (if required)
    61 // should be set by the calling function.
    62 
    63 bool do_query (FilterRequest_t &request, cgiargsclass &args,
    64            recptproto *collectproto, FilterResponse_t &response,
    65            ostream &logout) {
     61// request.filterResultOptions and request.fields (if required) should
     62// be set from the calling code
     63void set_queryfilter_options (FilterRequest_t &request, const text_t &querystring,
     64                  cgiargsclass &args) {
    6665
    6766  request.filterName = "QueryFilter";
    6867
    69   comerror_t err;
    7068  OptionValue_t option;
    71   text_t formattedstring = args["q"];
    72   format_querystring (formattedstring, args.getintarg("b")); 
    7369
    7470  option.name = "Term";
    75   option.value = formattedstring;
     71  option.value = querystring;
    7672  request.filterOptions.push_back (option);
    7773
     
    106102  }
    107103
     104  set_more_queryfilter_options (request, args);
     105}
     106
     107void set_queryfilter_options (FilterRequest_t &request, const text_t &querystring1,
     108                  const text_t &querystring2, cgiargsclass &args) {
     109
     110  set_queryfilter_options (request, querystring1, args);
     111
    108112  // fill in the second query if needed
    109113  if (!args["cq2"].empty()) {
     114    OptionValue_t option;
     115
    110116    option.name = "CombineQuery";
    111117    option.value = args["cq2"];
    112118    request.filterOptions.push_back (option);
    113119   
    114     text_t formattedstring2 = args["q2"];
    115     format_querystring (formattedstring2, args.getintarg("b"));
    116 
    117120    option.name = "Term";
    118     option.value = formattedstring2;
    119     request.filterOptions.push_back (option);
    120 
     121    option.value = querystring2;
     122    request.filterOptions.push_back (option);
     123   
    121124    option.name = "QueryType";
    122125    option.value = (args.getintarg("t")) ? "ranked" : "boolean";
     
    149152    }
    150153  }
    151 
     154  set_more_queryfilter_options (request, args);
     155}
     156
     157void set_more_queryfilter_options (FilterRequest_t &request, cgiargsclass &args) {
     158
     159  OptionValue_t option;
    152160  int arg_m = args.getintarg("m");
    153 
     161 
    154162  option.name = "Maxdocs";
    155163  option.value = arg_m;
    156164  request.filterOptions.push_back (option);
    157165 
    158   option.name = "StartResults";
    159   option.value = args["r"];
    160   request.filterOptions.push_back (option);
    161 
    162   option.name = "EndResults";
    163   int endresults = args.getintarg("o") + (args.getintarg("r") - 1);
    164   if ((endresults > arg_m) && (arg_m != -1)) endresults = arg_m;
    165   option.value = endresults;
    166   request.filterOptions.push_back (option);
    167 
    168   collectproto->filter (args["c"], request, response, err, logout);
    169 
    170   if (err != noError) {
    171     outconvertclass text_t2ascii;
    172     logout << text_t2ascii
    173        << "Error: call to QueryFilter failed in queryaction ("
    174        << get_comerror_string (err) << ")\n";
    175     return false;
    176   }
    177   return true;
     166  //  option.name = "StartResults";
     167  //  option.value = args["r"];
     168  //  request.filterOptions.push_back (option);
     169
     170  //  option.name = "EndResults";
     171  //  int endresults = args.getintarg("o") + (args.getintarg("r") - 1);
     172  //  if ((endresults > arg_m) && (arg_m != -1)) endresults = arg_m;
     173  //  option.value = endresults;
     174  //  request.filterOptions.push_back (option);
    178175}
    179176
Note: See TracChangeset for help on using the changeset viewer.